add OBS + upgrade level sounds
| | |
| | | 13CBCCE42C747C3D00C67701 /* NoticeCenterUserRepeaceDetailVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13CBCCE22C747C3D00C67701 /* NoticeCenterUserRepeaceDetailVC.xib */; }; |
| | | 13D256B42C6C68E7006FC2D7 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13D256B32C6C68E7006FC2D7 /* ShareView.swift */; }; |
| | | 13D256B72C6C68F8006FC2D7 /* ShareView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13D256B62C6C68F8006FC2D7 /* ShareView.xib */; }; |
| | | 13D2A0492CB670BF005F6014 /* OBSUploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13D2A0482CB670BF005F6014 /* OBSUploader.swift */; }; |
| | | 13D2A0572CB67F74005F6014 /* OBS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D2A0562CB67F74005F6014 /* OBS.framework */; }; |
| | | 13DC34EE2C913E77007E1B61 /* TreeTeskFirstRuleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13DC34ED2C913E77007E1B61 /* TreeTeskFirstRuleView.swift */; }; |
| | | 13DC34F02C913E7F007E1B61 /* TreeTeskFirstRuleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13DC34EF2C913E7F007E1B61 /* TreeTeskFirstRuleView.xib */; }; |
| | | 13E0FBF92C6C8BDE009997AE /* CountdownChooseListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E0FBF82C6C8BDE009997AE /* CountdownChooseListView.swift */; }; |
| | |
| | | 13CBCCE22C747C3D00C67701 /* NoticeCenterUserRepeaceDetailVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoticeCenterUserRepeaceDetailVC.xib; sourceTree = "<group>"; }; |
| | | 13D256B32C6C68E7006FC2D7 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = "<group>"; }; |
| | | 13D256B62C6C68F8006FC2D7 /* ShareView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShareView.xib; sourceTree = "<group>"; }; |
| | | 13D2A0482CB670BF005F6014 /* OBSUploader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OBSUploader.swift; sourceTree = "<group>"; }; |
| | | 13D2A0562CB67F74005F6014 /* OBS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OBS.framework; sourceTree = "<group>"; }; |
| | | 13DC34ED2C913E77007E1B61 /* TreeTeskFirstRuleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TreeTeskFirstRuleView.swift; sourceTree = "<group>"; }; |
| | | 13DC34EF2C913E7F007E1B61 /* TreeTeskFirstRuleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TreeTeskFirstRuleView.xib; sourceTree = "<group>"; }; |
| | | 13E0FBF82C6C8BDE009997AE /* CountdownChooseListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountdownChooseListView.swift; sourceTree = "<group>"; }; |
| | |
| | | buildActionMask = 2147483647; |
| | | files = ( |
| | | D80DD987C5D5D23DD582763D /* Pods_XQMuse.framework in Frameworks */, |
| | | 13D2A0572CB67F74005F6014 /* OBS.framework in Frameworks */, |
| | | ); |
| | | runOnlyForDeploymentPostprocessing = 0; |
| | | }; |
| | |
| | | 137ECAD12C783C0700C338BE /* TreeGroup */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | 13D2A0472CB6700C005F6014 /* Voices */, |
| | | 135D091D2C9167E600658880 /* TCell */, |
| | | 13846C752C9163960078B68F /* VC */, |
| | | 131CE0F32C91295600D1234A /* View */, |
| | |
| | | 1385DFFB2C6C4F1200AADB1F /* NetworkRequest.swift */, |
| | | 1385DFFD2C6C4F1200AADB1F /* Services.swift */, |
| | | 135B1D212C8868170089A9BE /* Models.swift */, |
| | | 13D2A0482CB670BF005F6014 /* OBSUploader.swift */, |
| | | ); |
| | | path = Network; |
| | | sourceTree = "<group>"; |
| | |
| | | 13985DB32C69B7D40046B6DC /* Config */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | 13D2A0542CB671D9005F6014 /* SDK */, |
| | | 1304526E2CB4FF280049FB3A /* InPurchaseManager.swift */, |
| | | 130452692CB4CA310049FB3A /* XQMuseStoreKit.storekit */, |
| | | 1304526B2CB4CB210049FB3A /* StoreKitTestCertificate.cer */, |
| | |
| | | 13E7FAC12C9D1644009432D4 /* NoticeBtn.swift */, |
| | | ); |
| | | path = View; |
| | | sourceTree = "<group>"; |
| | | }; |
| | | 13D2A0472CB6700C005F6014 /* Voices */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | ); |
| | | path = Voices; |
| | | sourceTree = "<group>"; |
| | | }; |
| | | 13D2A0542CB671D9005F6014 /* SDK */ = { |
| | | isa = PBXGroup; |
| | | children = ( |
| | | 13D2A0562CB67F74005F6014 /* OBS.framework */, |
| | | ); |
| | | path = SDK; |
| | | sourceTree = "<group>"; |
| | | }; |
| | | 13EC08922C74990F00E00128 /* CCell */ = { |
| | |
| | | 135C2A752C7F033300CC2A67 /* CLPlayerView.swift in Sources */, |
| | | 1300BD3C2C6DFB1C000BCA5E /* VIPCenterVC.swift in Sources */, |
| | | 134803D62C76E3E000F4FDDA /* WatchHistoryVC.swift in Sources */, |
| | | 13D2A0492CB670BF005F6014 /* OBSUploader.swift in Sources */, |
| | | 135B1D252C8947630089A9BE /* UserViewModel.swift in Sources */, |
| | | 1377B4162C6DCC4300CF7CA5 /* Home_Style_4_Inner_1_CCell.swift in Sources */, |
| | | 135C2A6D2C7F033300CC2A67 /* CLRotateAnimationView.swift in Sources */, |
| | |
| | | buildSettings = { |
| | | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| | | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| | | CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; |
| | | CODE_SIGN_ENTITLEMENTS = XQMuse/XQMuse.entitlements; |
| | | CODE_SIGN_IDENTITY = "Apple Development"; |
| | | CODE_SIGN_STYLE = Automatic; |
| | | CURRENT_PROJECT_VERSION = 1; |
| | | DEVELOPMENT_TEAM = 5ZV937VB25; |
| | | ENABLE_USER_SCRIPT_SANDBOXING = NO; |
| | | FRAMEWORK_SEARCH_PATHS = ( |
| | | "$(inherited)", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK\\ 2", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK\\ 2", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK", |
| | | ); |
| | | GENERATE_INFOPLIST_FILE = YES; |
| | | INFOPLIST_FILE = XQMuse/Info.plist; |
| | | INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; |
| | |
| | | "@executable_path/Frameworks", |
| | | ); |
| | | MARKETING_VERSION = 1.0; |
| | | OTHER_LDFLAGS = ( |
| | | "$(inherited)", |
| | | "-l\"WechatOpenSDK\"", |
| | | "-l\"c++\"", |
| | | "-l\"resolv\"", |
| | | "-l\"sqlite3.0\"", |
| | | "-l\"swiftCoreGraphics\"", |
| | | "-l\"z\"", |
| | | "-framework", |
| | | "\"APNGKit\"", |
| | | "-framework", |
| | | "\"AVFoundation\"", |
| | | "-framework", |
| | | "\"Alamofire\"", |
| | | "-framework", |
| | | "\"CFNetwork\"", |
| | | "-framework", |
| | | "\"CoreGraphics\"", |
| | | "-framework", |
| | | "\"CoreImage\"", |
| | | "-framework", |
| | | "\"CoreMedia\"", |
| | | "-framework", |
| | | "\"CoreServices\"", |
| | | "-framework", |
| | | "\"CoreTelephony\"", |
| | | "-framework", |
| | | "\"CryptoSwift\"", |
| | | "-framework", |
| | | "\"Delegate\"", |
| | | "-framework", |
| | | "\"Differentiator\"", |
| | | "-framework", |
| | | "\"EmptyDataSet_Swift\"", |
| | | "-framework", |
| | | "\"FFPage\"", |
| | | "-framework", |
| | | "\"Foundation\"", |
| | | "-framework", |
| | | "\"HandyJSON\"", |
| | | "-framework", |
| | | "\"IQKeyboardManager\"", |
| | | "-framework", |
| | | "\"IQKeyboardManagerSwift\"", |
| | | "-framework", |
| | | "\"ImageIO\"", |
| | | "-framework", |
| | | "\"JQTools\"", |
| | | "-framework", |
| | | "\"Lantern\"", |
| | | "-framework", |
| | | "\"MJRefresh\"", |
| | | "-framework", |
| | | "\"ObjcExceptionBridging\"", |
| | | "-framework", |
| | | "\"ObjectMapper\"", |
| | | "-framework", |
| | | "\"Photos\"", |
| | | "-framework", |
| | | "\"PhotosUI\"", |
| | | "-framework", |
| | | "\"QMUIKit\"", |
| | | "-framework", |
| | | "\"QuartzCore\"", |
| | | "-framework", |
| | | "\"RxCocoa\"", |
| | | "-framework", |
| | | "\"RxDataSources\"", |
| | | "-framework", |
| | | "\"RxRelay\"", |
| | | "-framework", |
| | | "\"RxSwift\"", |
| | | "-framework", |
| | | "\"SDWebImage\"", |
| | | "-framework", |
| | | "\"SPPageMenu\"", |
| | | "-framework", |
| | | "\"SVProgressHUD\"", |
| | | "-framework", |
| | | "\"Security\"", |
| | | "-framework", |
| | | "\"SnapKit\"", |
| | | "-framework", |
| | | "\"SwifterSwift\"", |
| | | "-framework", |
| | | "\"SwiftyStoreKit\"", |
| | | "-framework", |
| | | "\"SystemConfiguration\"", |
| | | "-framework", |
| | | "\"TZImagePickerController\"", |
| | | "-framework", |
| | | "\"UIKit\"", |
| | | "-framework", |
| | | "\"UserDefaultsStore\"", |
| | | "-framework", |
| | | "\"VTMagic\"", |
| | | "-framework", |
| | | "\"WebKit\"", |
| | | "-framework", |
| | | "\"XCGLogger\"", |
| | | "-force_load", |
| | | "$(SRCROOT)/XQMuse/Config/SDK/OBS.framework/OBS", |
| | | ); |
| | | PRODUCT_BUNDLE_IDENTIFIER = com.sinata.XQMuse.test; |
| | | PRODUCT_NAME = "$(TARGET_NAME)"; |
| | | PROVISIONING_PROFILE_SPECIFIER = ""; |
| | |
| | | buildSettings = { |
| | | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| | | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| | | CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; |
| | | CODE_SIGN_ENTITLEMENTS = XQMuse/XQMuse.entitlements; |
| | | CODE_SIGN_IDENTITY = "Apple Development"; |
| | | CODE_SIGN_STYLE = Automatic; |
| | | CURRENT_PROJECT_VERSION = 1; |
| | | DEVELOPMENT_TEAM = 5ZV937VB25; |
| | | ENABLE_USER_SCRIPT_SANDBOXING = NO; |
| | | FRAMEWORK_SEARCH_PATHS = ( |
| | | "$(inherited)", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK\\ 2", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK\\ 2", |
| | | "$(PROJECT_DIR)/XQMuse/Config/SDK", |
| | | ); |
| | | GENERATE_INFOPLIST_FILE = YES; |
| | | INFOPLIST_FILE = XQMuse/Info.plist; |
| | | INFOPLIST_KEY_CFBundleDisplayName = "心泉冥想"; |
| | |
| | | "@executable_path/Frameworks", |
| | | ); |
| | | MARKETING_VERSION = 1.0; |
| | | OTHER_LDFLAGS = ( |
| | | "$(inherited)", |
| | | "-l\"WechatOpenSDK\"", |
| | | "-l\"c++\"", |
| | | "-l\"resolv\"", |
| | | "-l\"sqlite3.0\"", |
| | | "-l\"swiftCoreGraphics\"", |
| | | "-l\"z\"", |
| | | "-framework", |
| | | "\"APNGKit\"", |
| | | "-framework", |
| | | "\"AVFoundation\"", |
| | | "-framework", |
| | | "\"Alamofire\"", |
| | | "-framework", |
| | | "\"CFNetwork\"", |
| | | "-framework", |
| | | "\"CoreGraphics\"", |
| | | "-framework", |
| | | "\"CoreImage\"", |
| | | "-framework", |
| | | "\"CoreMedia\"", |
| | | "-framework", |
| | | "\"CoreServices\"", |
| | | "-framework", |
| | | "\"CoreTelephony\"", |
| | | "-framework", |
| | | "\"CryptoSwift\"", |
| | | "-framework", |
| | | "\"Delegate\"", |
| | | "-framework", |
| | | "\"Differentiator\"", |
| | | "-framework", |
| | | "\"EmptyDataSet_Swift\"", |
| | | "-framework", |
| | | "\"FFPage\"", |
| | | "-framework", |
| | | "\"Foundation\"", |
| | | "-framework", |
| | | "\"HandyJSON\"", |
| | | "-framework", |
| | | "\"IQKeyboardManager\"", |
| | | "-framework", |
| | | "\"IQKeyboardManagerSwift\"", |
| | | "-framework", |
| | | "\"ImageIO\"", |
| | | "-framework", |
| | | "\"JQTools\"", |
| | | "-framework", |
| | | "\"Lantern\"", |
| | | "-framework", |
| | | "\"MJRefresh\"", |
| | | "-framework", |
| | | "\"ObjcExceptionBridging\"", |
| | | "-framework", |
| | | "\"ObjectMapper\"", |
| | | "-framework", |
| | | "\"Photos\"", |
| | | "-framework", |
| | | "\"PhotosUI\"", |
| | | "-framework", |
| | | "\"QMUIKit\"", |
| | | "-framework", |
| | | "\"QuartzCore\"", |
| | | "-framework", |
| | | "\"RxCocoa\"", |
| | | "-framework", |
| | | "\"RxDataSources\"", |
| | | "-framework", |
| | | "\"RxRelay\"", |
| | | "-framework", |
| | | "\"RxSwift\"", |
| | | "-framework", |
| | | "\"SDWebImage\"", |
| | | "-framework", |
| | | "\"SPPageMenu\"", |
| | | "-framework", |
| | | "\"SVProgressHUD\"", |
| | | "-framework", |
| | | "\"Security\"", |
| | | "-framework", |
| | | "\"SnapKit\"", |
| | | "-framework", |
| | | "\"SwifterSwift\"", |
| | | "-framework", |
| | | "\"SwiftyStoreKit\"", |
| | | "-framework", |
| | | "\"SystemConfiguration\"", |
| | | "-framework", |
| | | "\"TZImagePickerController\"", |
| | | "-framework", |
| | | "\"UIKit\"", |
| | | "-framework", |
| | | "\"UserDefaultsStore\"", |
| | | "-framework", |
| | | "\"VTMagic\"", |
| | | "-framework", |
| | | "\"WebKit\"", |
| | | "-framework", |
| | | "\"XCGLogger\"", |
| | | "-force_load", |
| | | "$(SRCROOT)/XQMuse/Config/SDK/OBS.framework/OBS", |
| | | ); |
| | | PRODUCT_BUNDLE_IDENTIFIER = com.sinata.XQMuse.test; |
| | | PRODUCT_NAME = "$(TARGET_NAME)"; |
| | | PROVISIONING_PROFILE_SPECIFIER = ""; |
| | |
| | | case .level_10:return "第十" |
| | | } |
| | | } |
| | | |
| | | var sound:String{ |
| | | switch self { |
| | | case .level_1: return oss_domain + "/xinquan/1d3254a9966b476789491032d8bb908a.wav" |
| | | case .level_2:return oss_domain + "/xinquan/d8daa4d5490f40f9a68a8469ad697660.wav" |
| | | case .level_3:return oss_domain + "/xinquan/0da0e117c4374c398347c480d2cfc6b4.wav" |
| | | case .level_4:return oss_domain + "/xinquan/6160ba07229a486da93880ac19db3768.wav" |
| | | case .level_5:return oss_domain + "/xinquan/1998498217564da7b3336fa867b5255d.wav" |
| | | case .level_6:return oss_domain + "/xinquan/d829bf1c7b544a83a7a09b5dfab3226d.wav" |
| | | case .level_7:return oss_domain + "/xinquan/0407fe616cd34ef0bffcd1d57520cd20.wav" |
| | | case .level_8:return oss_domain + "/xinquan/d3980143fbc14f86b635efd05f05c24e.wav" |
| | | case .level_9:return oss_domain + "/xinquan/b7bb109fc64f49e481013fe1c8f4693e.wav" |
| | | case .level_10:return oss_domain + "/xinquan/8b0303829a6547f5a16c5232883b94cc.wav" |
| | | } |
| | | } |
| | | } |
| | | |
| | | enum TreeTeskDetailType:Int{ |
New file |
| | |
| | | //
|
| | | // NSArray+OBSMTLManipulationAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Josh Abernathy on 9/19/12.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSArray (OBSMTLManipulationAdditions)
|
| | |
|
| | | /// The first object in the array or nil if the array is empty.
|
| | | /// Forwards to `firstObject` which has been first declared in iOS7, but works with iOS4/10.6.
|
| | | @property (nonatomic, readonly, strong) id obs_mtl_firstObject;
|
| | |
|
| | | /// Returns a new array without all instances of the given object.
|
| | | - (NSArray *)obs_mtl_arrayByRemovingObject:(id)object;
|
| | |
|
| | | /// Returns a new array without the first object. If the array is empty, it
|
| | | /// returns the empty array.
|
| | | - (NSArray *)obs_mtl_arrayByRemovingFirstObject;
|
| | |
|
| | | /// Returns a new array without the last object. If the array is empty, it
|
| | | /// returns the empty array.
|
| | | - (NSArray *)obs_mtl_arrayByRemovingLastObject;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSDictionary+OBSMTLJSONKeyPath.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Robert Böhnke on 19/03/14.
|
| | | // Copyright (c) 2014 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSDictionary (OBSMTLJSONKeyPath)
|
| | |
|
| | | /// Looks up the value of a key path in the receiver.
|
| | | ///
|
| | | /// JSONKeyPath - The key path that should be resolved. Every element along this
|
| | | /// key path needs to be an instance of NSDictionary for the
|
| | | /// resolving to be successful.
|
| | | /// success - If not NULL, this will be set to a boolean indicating whether
|
| | | /// the key path was resolved successfully.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// resolving the value.
|
| | | ///
|
| | | /// Returns the value for the key path which may be nil. Clients should inspect
|
| | | /// the success parameter to decide how to proceed with the result.
|
| | | - (id)obs_mtl_valueForJSONKeyPath:(NSString *)JSONKeyPath success:(BOOL *)success error:(NSError **)error;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSDictionary+OBSMTLManipulationAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2012-09-24.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSDictionary (OBSMTLManipulationAdditions)
|
| | |
|
| | | /// Merges the keys and values from the given dictionary into the receiver. If
|
| | | /// both the receiver and `dictionary` have a given key, the value from
|
| | | /// `dictionary` is used.
|
| | | ///
|
| | | /// Returns a new dictionary containing the entries of the receiver combined with
|
| | | /// those of `dictionary`.
|
| | | - (NSDictionary *)obs_mtl_dictionaryByAddingEntriesFromDictionary:(NSDictionary *)dictionary;
|
| | |
|
| | | /// Creates a new dictionary with all the entries for the given keys removed from
|
| | | /// the receiver.
|
| | | - (NSDictionary *)obs_mtl_dictionaryByRemovingValuesForKeys:(NSArray *)keys;
|
| | |
|
| | | @end
|
| | |
|
| | | @interface NSDictionary (OBSMTLManipulationAdditions_Deprecated)
|
| | |
|
| | | - (NSDictionary *)obs_mtl_dictionaryByRemovingEntriesWithKeys:(NSSet *)keys __attribute__((deprecated("Replaced by -obs_mtl_dictionaryByRemovingValuesForKeys:")));
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSDictionary+OBSMTLMappingAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Robert Böhnke on 10/31/13.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSDictionary (OBSMTLMappingAdditions)
|
| | |
|
| | | /// Creates an identity mapping for serialization.
|
| | | ///
|
| | | /// class - A subclass of OBSMTLModel.
|
| | | ///
|
| | | /// Returns a dictionary that maps all properties of the given class to
|
| | | /// themselves.
|
| | | + (NSDictionary *)obs_mtl_identityPropertyMapWithModel:(Class)modelClass;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSError+OBSMTLModelException.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Robert Böhnke on 7/6/13.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSError (OBSMTLModelException)
|
| | |
|
| | | /// Creates a new error for an exception that occurred during updating an
|
| | | /// OBSMTLModel.
|
| | | ///
|
| | | /// exception - The exception that was thrown while updating the model.
|
| | | /// This argument must not be nil.
|
| | | ///
|
| | | /// Returns an error that takes its localized description and failure reason
|
| | | /// from the exception.
|
| | | + (instancetype)obs_mtl_modelErrorWithException:(NSException *)exception;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSObject+OBSMTLComparisonAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Josh Vera on 10/26/12.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | | // Portions copyright (c) 2011 Bitswift. All rights reserved.
|
| | | // See the LICENSE file for more information.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | /// Returns whether both objects are identical or equal via -isEqual:
|
| | | BOOL OBSMTLEqualObjects(id obj1, id obj2);
|
New file |
| | |
| | | //
|
| | | // NSValueTransformer+OBSMTLInversionAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2013-05-18.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @interface NSValueTransformer (OBSMTLInversionAdditions)
|
| | |
|
| | | /// Flips the direction of the receiver's transformation, such that
|
| | | /// -transformedValue: will become -reverseTransformedValue:, and vice-versa.
|
| | | ///
|
| | | /// The receiver must allow reverse transformation.
|
| | | ///
|
| | | /// Returns an inverted transformer.
|
| | | - (NSValueTransformer *)obs_mtl_invertedTransformer;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // NSValueTransformer+OBSMTLPredefinedTransformerAdditions.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2012-09-27.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | #import "OBSMTLTransformerErrorHandling.h"
|
| | |
|
| | | /// The name for a value transformer that converts strings into URLs and back.
|
| | | extern NSString *const OBSMTLURLValueTransformerName;
|
| | |
|
| | | /// The name for a value transformer that converts strings into NSUUIDs and back.
|
| | | extern NSString *const OBSMTLUUIDValueTransformerName;
|
| | |
|
| | | /// Ensure an NSNumber is backed by __NSCFBoolean/CFBooleanRef
|
| | | ///
|
| | | /// NSJSONSerialization, and likely other serialization libraries, ordinarily
|
| | | /// serialize NSNumbers as numbers, and thus booleans would be serialized as
|
| | | /// 0/1. The exception is when the NSNumber is backed by __NSCFBoolean, which,
|
| | | /// though very much an implementation detail, is detected and serialized as a
|
| | | /// proper boolean.
|
| | | extern NSString *const OBSMTLBooleanValueTransformerName;
|
| | |
|
| | | @interface NSValueTransformer (OBSMTLPredefinedTransformerAdditions)
|
| | |
|
| | | /// An optionally reversible transformer which applies the given transformer to
|
| | | /// each element of an array.
|
| | | ///
|
| | | /// transformer - The transformer to apply to each element. If the transformer
|
| | | /// is reversible, the transformer returned by this method will be
|
| | | /// reversible. This argument must not be nil.
|
| | | ///
|
| | | /// Returns a transformer which applies a transformation to each element of an
|
| | | /// array.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_arrayMappingTransformerWithTransformer:(NSValueTransformer *)transformer;
|
| | |
|
| | | /// A reversible value transformer to transform between the keys and objects of a
|
| | | /// dictionary.
|
| | | ///
|
| | | /// dictionary - The dictionary whose keys and values should be
|
| | | /// transformed between. This argument must not be nil.
|
| | | /// defaultValue - The result to fall back to, in case no key matching the
|
| | | /// input value was found during a forward transformation.
|
| | | /// reverseDefaultValue - The result to fall back to, in case no value matching
|
| | | /// the input value was found during a reverse
|
| | | /// transformation.
|
| | | ///
|
| | | /// Can for example be used for transforming between enum values and their string
|
| | | /// representation.
|
| | | ///
|
| | | /// NSValueTransformer *valueTransformer = [NSValueTransformer obs_mtl_valueMappingTransformerWithDictionary:@{
|
| | | /// @"foo": @(EnumDataTypeFoo),
|
| | | /// @"bar": @(EnumDataTypeBar),
|
| | | /// } defaultValue: @(EnumDataTypeUndefined) reverseDefaultValue: @"undefined"];
|
| | | ///
|
| | | /// Returns a transformer which will map from keys to objects for forward
|
| | | /// transformations, and from objects to keys for reverse transformations.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary defaultValue:(id)defaultValue reverseDefaultValue:(id)reverseDefaultValue;
|
| | |
|
| | | /// Returns a value transformer created by calling
|
| | | /// `+obs_mtl_valueMappingTransformerWithDictionary:defaultValue:reverseDefaultValue:`
|
| | | /// with a default value of `nil` and a reverse default value of `nil`.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_valueMappingTransformerWithDictionary:(NSDictionary *)dictionary;
|
| | |
|
| | | /// A reversible value transformer to transform between a date and its string
|
| | | /// representation
|
| | | ///
|
| | | /// dateFormat - The date format used by the date formatter (http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Field_Symbol_Table)
|
| | | /// calendar - The calendar used by the date formatter
|
| | | /// locale - The locale used by the date formatter
|
| | | /// timeZone - The time zone used by the date formatter
|
| | | ///
|
| | | /// Returns a transformer which will map from strings to dates for forward
|
| | | /// transformations, and from dates to strings for reverse transformations.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_dateTransformerWithDateFormat:(NSString *)dateFormat calendar:(NSCalendar *)calendar locale:(NSLocale *)locale timeZone:(NSTimeZone *)timeZone defaultDate:(NSDate *)defaultDate;
|
| | |
|
| | | /// Returns a value transformer created by calling
|
| | | /// `+obs_mtl_dateTransformerWithDateFormat:calendar:locale:timeZone:defaultDate:`
|
| | | /// with a calendar, locale, time zone and default date of `nil`.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_dateTransformerWithDateFormat:(NSString *)dateFormat locale:(NSLocale *)locale;
|
| | |
|
| | | /// A reversible value transformer to transform between a number and its string
|
| | | /// representation
|
| | | ///
|
| | | /// numberStyle - The number style used by the number formatter
|
| | | ///
|
| | | /// Returns a transformer which will map from strings to numbers for forward
|
| | | /// transformations, and from numbers to strings for reverse transformations.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_numberTransformerWithNumberStyle:(NSNumberFormatterStyle)numberStyle locale:(NSLocale *)locale;
|
| | |
|
| | | /// A reversible value transformer to transform between an object and its string
|
| | | /// representation
|
| | | ///
|
| | | /// formatter - The formatter used to perform the transformation
|
| | | /// objectClass - The class of object that the formatter operates on
|
| | | ///
|
| | | /// Returns a transformer which will map from strings to objects for forward
|
| | | /// transformations, and from objects to strings for reverse transformations.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_transformerWithFormatter:(NSFormatter *)formatter forObjectClass:(Class)objectClass;
|
| | |
|
| | | /// A value transformer that errors if the transformed value are not of the given
|
| | | /// class.
|
| | | ///
|
| | | /// class - The expected class. This argument must not be nil.
|
| | | ///
|
| | | /// Returns a transformer which will return an error if the transformed in value
|
| | | /// is not a member of class. Otherwise, the value is simply passed through.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_validatingTransformerForClass:(Class)modelClass;
|
| | |
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_JSONDictionaryTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +[OBSMTLJSONAdapter dictionaryTransformerWithModelClass:]")));
|
| | |
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)obs_mtl_JSONArrayTransformerWithModelClass:(Class)modelClass __attribute__((deprecated("Replaced by +[OBSMTLJSONAdapter arrayTransformerWithModelClass:]")));
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBS_h |
| | | #define OBS_h |
| | | #import <Foundation/Foundation.h> |
| | | |
| | | NS_ASSUME_NONNULL_BEGIN |
| | | //! Project version number for OBS. |
| | | FOUNDATION_EXPORT double OBSVersionNumber; |
| | | |
| | | //! Project version string for OBS. |
| | | FOUNDATION_EXPORT unsigned char OBSVersionString[]; |
| | | NS_ASSUME_NONNULL_END |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSUtils.h" |
| | | #import "OBSBolts.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | #import "OBSMantle.h" |
| | | #import "OBSLogging.h" |
| | | |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark service models |
| | | #pragma mark presign |
| | | #import "OBSPreSignedURLModel.h" |
| | | |
| | | #pragma mark bucket |
| | | #import "OBSListBucketsModel.h" |
| | | #import "OBSCreateBucketModel.h" |
| | | |
| | | |
| | | #import "OBSGetBucketMetaDataModel.h" |
| | | #import "OBSGetBucketLocationModel.h" |
| | | #import "OBSGetBucketStorageInfoModel.h" |
| | | |
| | | #import "OBSSetBucketQuotaModel.h" |
| | | #import "OBSGetBucketQuotaModel.h" |
| | | |
| | | #import "OBSSetBucketACLModel.h" |
| | | #import "OBSGetBucketACLModel.h" |
| | | |
| | | #import "OBSSetBucketCORSModel.h" |
| | | #import "OBSGetBucketCORSModel.h" |
| | | #import "OBSDeleteBucketCORSModel.h" |
| | | |
| | | #import "OBSSetBucketStoragePolicyModel.h" |
| | | #import "OBSGetBucketStoragePolicyModel.h" |
| | | |
| | | #import "OBSSetBucketLoggingModel.h" |
| | | #import "OBSGetBucketLoggingModel.h" |
| | | |
| | | #import "OBSSetBucketPolicyModel.h" |
| | | #import "OBSGetBucketPolicyModel.h" |
| | | #import "OBSDeleteBucketPolicyModel.h" |
| | | |
| | | #import "OBSSetBucketLifecycleModel.h" |
| | | #import "OBSGetBucketLifecycleModel.h" |
| | | #import "OBSDeleteBucketLifecycleModel.h" |
| | | |
| | | #import "OBSSetBucketWebsiteModel.h" |
| | | #import "OBSGetBucketWebsiteModel.h" |
| | | #import "OBSDeleteBucketWebsiteModel.h" |
| | | |
| | | #import "OBSSetBucketVersioningModel.h" |
| | | #import "OBSGetBucketVersioningModel.h" |
| | | |
| | | #import "OBSSetBucketNotificationModel.h" |
| | | #import "OBSGetBucketNotificationModel.h" |
| | | |
| | | #import "OBSOptionsBucketModel.h" |
| | | |
| | | #import "OBSListMultipartUploadsModel.h" |
| | | |
| | | #import "OBSSetBucketTaggingModel.h" |
| | | #import "OBSGetBucketTaggingModel.h" |
| | | #import "OBSDeleteBucketTaggingModel.h" |
| | | |
| | | #import "OBSDeleteBucketModel.h" |
| | | #import "OBSReplicateBucketModel.h" |
| | | #import "OBSGetReplicateBucketModel.h" |
| | | #import "OBSDeleteReplicateBucketModel.h" |
| | | #import "OBSAppendObjectModel.h" |
| | | |
| | | #pragma mark object |
| | | #import "OBSPutObjectModel.h" |
| | | #import "OBSGetObjectModel.h" |
| | | #import "OBSCopyObjectModel.h" |
| | | |
| | | #import "OBSSetObjectACLModel.h" |
| | | #import "OBSGetObjectACLModel.h" |
| | | |
| | | #import "OBSListObjectsModel.h" |
| | | #import "OBSListObjectsVersionsModel.h" |
| | | |
| | | #import "OBSGetObjectMetaDataModel.h" |
| | | #import "OBSOptionsObjectModel.h" |
| | | #import "OBSRestoreObjectModel.h" |
| | | |
| | | #import "OBSInitiateMultipartUploadModel.h" |
| | | #import "OBSUploadPartModel.h" |
| | | #import "OBSCopyPartModel.h" |
| | | #import "OBSListPartsModel.h" |
| | | #import "OBSCompleteMultipartUploadModel.h" |
| | | #import "OBSAbortMultipartUploadModel.h" |
| | | |
| | | #import "OBSDeleteObjectModel.h" |
| | | #import "OBSDeleteObjectsModel.h" |
| | | |
| | | #pragma mark additional |
| | | #import "OBSDownloadFileModel.h" |
| | | #import "OBSUploadFileModel.h" |
| | | |
| | | #import "OBSUploadFileModel.h" |
| | | #import "OBSGetBucketLocationModel.h" |
| | | #import "OBSGetBucketStorageInfoModel.h" |
| | | #import "OBSSetBucketQuotaModel.h" |
| | | #import "OBSGetBucketStorageInfoModel.h" |
| | | #import "OBSServiceUtils.h" |
| | | #import "OBSListPartsModel.h" |
| | | #import "OBSAbortMultipartUploadModel.h" |
| | | #import "OBSCompleteMultipartUploadModel.h" |
| | | #import "OBSDownloadFileModel.h" |
| | | #import "OBSDeleteObjectModel.h" |
| | | #import "OBSDeleteObjectsModel.h" |
| | | #endif /* OBS_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSAbortMultipartUploadModel_h |
| | | #define OBSAbortMultipartUploadModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 取消多段上传任务 |
| | | */ |
| | | @protocol OBSAbortMultipartUploadProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 取消多段上传任务request |
| | | */ |
| | | @interface OBSAbortMultipartUploadRequest : OBSBaseRequest<OBSAbortMultipartUploadProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 初始化取消多段上传任务request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @param uploadID 多段上传任务ID |
| | | @return 取消多段上传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadID:(NSString*) uploadID; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingAbortMultipartUploadRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 取消多段上传response |
| | | */ |
| | | @interface OBSAbortMultipartUploadResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(abortMultipartUpload) |
| | | |
| | | /** |
| | | 取消多段上传 |
| | | |
| | | @param request 取消多段上传request |
| | | @param completionHandler 取消多段上传回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)abortMultipartUpload:(__kindof OBSBaseRequest<OBSAbortMultipartUploadProtocol>*)request |
| | | completionHandler:(void (^)(OBSAbortMultipartUploadResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSAbortMultipartUploadModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSAppendObjectRequest_h |
| | | #define OBSAppendObjectRequest_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | //request |
| | | @class OBSAbstractEncryption; |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 上传对象 |
| | | */ |
| | | @protocol OBSAppendObjectProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | MD5值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *contentMD5; |
| | | |
| | | /** |
| | | 对象访问策略 |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 重定向地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传进度 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 上传对象request父类 |
| | | */ |
| | | @interface OBSAbstractAppendObjectRequest : OBSBaseRequest<OBSAppendObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象描述标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象的MD5 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *contentMD5; |
| | | |
| | | /** |
| | | 对象的ACL |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 对象重定向地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象和获取对象元数据的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteRead; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象和获取对象元数据的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteReadAcp; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有获取对象ACL的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteWriteAcp; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象、获取对象元数据、获取对象ACL、写对象ACL的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteFullControl; |
| | | |
| | | /** |
| | | 此参数的值是一个URL,用于指定当此次请求操作成功响应后的重定向的地址 |
| | | 如果此参数值有效且操作成功,响应码为303,location头域由此参数以及桶名、对象名、对象的ETag组成 |
| | | 如果此参数值无效,忽略此参数的作用,响应码为204,location头域为对象地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *actionRedirect; |
| | | |
| | | /** |
| | | 表示上传对象的过期时间,单位是天 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *expires; |
| | | |
| | | /** |
| | | 追加写位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *position; |
| | | |
| | | |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传对象时的回调 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | |
| | | /** |
| | | 自定义MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *customContentType; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 流式上传对象request |
| | | */ |
| | | @interface OBSAppendObjectWithDataRequest: OBSAbstractAppendObjectRequest |
| | | |
| | | /** |
| | | 上传的数据 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSData *uploadData; |
| | | |
| | | /** |
| | | 初始化流式上传对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象名 |
| | | @param data 需要上传的对象数据 |
| | | @return 流式上传对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadData:(NSData*) data; |
| | | |
| | | /** |
| | | 初始上传网络流对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象名 |
| | | @param dataURL 需要上传的网络流地址 |
| | | @return 上传网络流对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadDataURL:(NSURL*) dataURL; |
| | | @end |
| | | |
| | | /** |
| | | 通过文件上传对象request |
| | | */ |
| | | @interface OBSAppendObjectWithFileRequest: OBSAbstractAppendObjectRequest |
| | | |
| | | /** |
| | | 文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | @property (nonatomic, assign) BOOL background; |
| | | |
| | | /** |
| | | 初始化通过文件上传对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象描述标识 |
| | | @param uploadFilePath 文件路径 |
| | | @return 通过文件上传对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadFilePath:(NSString*) uploadFilePath; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingAppendObjectWithDataRequest : OBSServiceNetworkingUploadDataRequest |
| | | @end |
| | | @interface OBSNetworkingAppendObjectWithFileRequest : OBSServiceNetworkingUploadFileRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 上传对象响应 |
| | | */ |
| | | @interface OBSAppendObjectResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 对象etag值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 如果桶开启了多版本状态 则返回版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(appendObject) |
| | | |
| | | /** |
| | | 上传对象 |
| | | |
| | | @param request 上传对象request |
| | | @param completionHandler 上传对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)appendObject:(__kindof OBSBaseRequest<OBSAppendObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSAppendObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSAppendObjectRequest_h */ |
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | #import "OBSBFCancellationTokenRegistration.h"
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /*!
|
| | | A block that will be called when a token is cancelled.
|
| | | */
|
| | | typedef void(^OBSBFCancellationBlock)(void);
|
| | |
|
| | | /*!
|
| | | The consumer view of a CancellationToken.
|
| | | Propagates notification that operations should be canceled.
|
| | | A OBSBFCancellationToken has methods to inspect whether the token has been cancelled.
|
| | | */
|
| | | @interface OBSBFCancellationToken : NSObject
|
| | |
|
| | | /*!
|
| | | Whether cancellation has been requested for this token source.
|
| | | */
|
| | | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested;
|
| | |
|
| | | /*!
|
| | | Register a block to be notified when the token is cancelled.
|
| | | If the token is already cancelled the delegate will be notified immediately.
|
| | | */
|
| | | - (OBSBFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OBSBFCancellationBlock)block;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /*!
|
| | | Represents the registration of a cancellation observer with a cancellation token.
|
| | | Can be used to unregister the observer at a later time.
|
| | | */
|
| | | @interface OBSBFCancellationTokenRegistration : NSObject
|
| | |
|
| | | /*!
|
| | | Removes the cancellation observer registered with the token
|
| | | and releases all resources associated with this registration.
|
| | | */
|
| | | - (void)dispose;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | @class OBSBFCancellationToken;
|
| | |
|
| | | /*!
|
| | | OBSBFCancellationTokenSource represents the producer side of a CancellationToken.
|
| | | Signals to a CancellationToken that it should be canceled.
|
| | | It is a cancellation token that also has methods
|
| | | for changing the state of a token by cancelling it.
|
| | | */
|
| | | @interface OBSBFCancellationTokenSource : NSObject
|
| | |
|
| | | /*!
|
| | | Creates a new cancellation token source.
|
| | | */
|
| | | + (instancetype)cancellationTokenSource;
|
| | |
|
| | | /*!
|
| | | The cancellation token associated with this CancellationTokenSource.
|
| | | */
|
| | | @property (nonatomic, strong, readonly) OBSBFCancellationToken *token;
|
| | |
|
| | | /*!
|
| | | Whether cancellation has been requested for this token source.
|
| | | */
|
| | | @property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested;
|
| | |
|
| | | /*!
|
| | | Cancels the token if it has not already been cancelled.
|
| | | */
|
| | | - (void)cancel;
|
| | |
|
| | | /*!
|
| | | Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.
|
| | | @param millis The number of milliseconds to wait before completing the returned task.
|
| | | If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped.
|
| | | */
|
| | | - (void)cancelAfterDelay:(int)millis;
|
| | |
|
| | | /*!
|
| | | Releases all resources associated with this token source,
|
| | | including disposing of all registrations.
|
| | | */
|
| | | - (void)dispose;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /*!
|
| | | An object that can run a given block.
|
| | | */
|
| | | @interface OBSBFExecutor : NSObject
|
| | |
|
| | | /*!
|
| | | Returns a default executor, which runs continuations immediately until the call stack gets too
|
| | | deep, then dispatches to a new GCD queue.
|
| | | */
|
| | | + (instancetype)defaultExecutor;
|
| | |
|
| | | /*!
|
| | | Returns an executor that runs continuations on the thread where the previous task was completed.
|
| | | */
|
| | | + (instancetype)immediateExecutor;
|
| | |
|
| | | /*!
|
| | | Returns an executor that runs continuations on the main thread.
|
| | | */
|
| | | + (instancetype)mainThreadExecutor;
|
| | |
|
| | | /*!
|
| | | Returns a new executor that uses the given block to execute continuations.
|
| | | @param block The block to use.
|
| | | */
|
| | | + (instancetype)executorWithBlock:(void(^)(void(^block)(void)))block;
|
| | |
|
| | | /*!
|
| | | Returns a new executor that runs continuations on the given queue.
|
| | | @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto.
|
| | | */
|
| | | + (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue;
|
| | |
|
| | | /*!
|
| | | Returns a new executor that runs continuations on the given queue.
|
| | | @param queue The instance of `NSOperationQueue` to run all continuations on.
|
| | | */
|
| | | + (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue;
|
| | |
|
| | | /*!
|
| | | Runs the given block using this executor's particular strategy.
|
| | | @param block The block to execute.
|
| | | */
|
| | | - (void)execute:(void(^)(void))block;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | #pragma once
|
| | |
|
| | | /**
|
| | | This exists to use along with `OBSBFTask` and `OBSBFTaskCompletionSource`.
|
| | |
|
| | | Instead of returning a `OBSBFTask` with no generic type, or a generic type of 'NSNull'
|
| | | when there is no usable result from a task, we use the type 'OBSBFVoid', which will always have a value of `nil`.
|
| | |
|
| | | This allows you to provide a more enforced API contract to the caller,
|
| | | as sending any message to `OBSBFVoid` will result in a compile time error.
|
| | | */
|
| | | @class _OBSBFVoid_Nonexistant;
|
| | | typedef _OBSBFVoid_Nonexistant *OBSBFVoid;
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | #import "OBSBFCancellationToken.h"
|
| | | #import "OBSBFGeneric.h"
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /*!
|
| | | Error domain used if there was multiple errors on <OBSBFTask taskForCompletionOfAllTasks:>.
|
| | | */
|
| | | extern NSString *const OBSBFTaskErrorDomain;
|
| | |
|
| | | /*!
|
| | | An error code used for <OBSBFTask taskForCompletionOfAllTasks:>, if there were multiple errors.
|
| | | */
|
| | | extern NSInteger const kOBSBFMultipleErrorsError;
|
| | |
|
| | | /*!
|
| | | An error userInfo key used if there were multiple errors on <OBSBFTask taskForCompletionOfAllTasks:>.
|
| | | Value type is `NSArray<NSError *> *`.
|
| | | */
|
| | | extern NSString *const OBSBFTaskMultipleErrorsUserInfoKey;
|
| | |
|
| | | @class OBSBFExecutor;
|
| | | @class OBSBFTask;
|
| | |
|
| | | /*!
|
| | | The consumer view of a Task. A OBSBFTask has methods to
|
| | | inspect the state of the task, and to add continuations to
|
| | | be run once the task is complete.
|
| | | */
|
| | | @interface OBSBFTask<__covariant ResultType> : NSObject
|
| | |
|
| | | /*!
|
| | | A block that can act as a continuation for a task.
|
| | | */
|
| | | typedef __nullable id(^OBSBFContinuationBlock)(OBSBFTask<ResultType> *t);
|
| | |
|
| | | /*!
|
| | | Creates a task that is already completed with the given result.
|
| | | @param result The result for the task.
|
| | | */
|
| | | + (instancetype)taskWithResult:(nullable ResultType)result;
|
| | |
|
| | | /*!
|
| | | Creates a task that is already completed with the given error.
|
| | | @param error The error for the task.
|
| | | */
|
| | | + (instancetype)taskWithError:(NSError *)error;
|
| | |
|
| | | /*!
|
| | | Creates a task that is already cancelled.
|
| | | */
|
| | | + (instancetype)cancelledTask;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed (with result == nil) once
|
| | | all of the input tasks have completed.
|
| | | @param tasks An `NSArray` of the tasks to use as an input.
|
| | | */
|
| | | + (instancetype)taskForCompletionOfAllTasks:(nullable NSArray<OBSBFTask *> *)tasks;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed once all of the input tasks have completed.
|
| | | If all tasks complete successfully without being faulted or cancelled the result will be
|
| | | an `NSArray` of all task results in the order they were provided.
|
| | | @param tasks An `NSArray` of the tasks to use as an input.
|
| | | */
|
| | | + (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray<OBSBFTask *> *)tasks;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed once there is at least one successful task.
|
| | | The first task to successuly complete will set the result, all other tasks results are
|
| | | ignored.
|
| | | @param tasks An `NSArray` of the tasks to use as an input.
|
| | | */
|
| | | + (instancetype)taskForCompletionOfAnyTask:(nullable NSArray<OBSBFTask *> *)tasks;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed a certain amount of time in the future.
|
| | | @param millis The approximate number of milliseconds to wait before the
|
| | | task will be finished (with result == nil).
|
| | | */
|
| | | + (OBSBFTask<OBSBFVoid> *)taskWithDelay:(int)millis;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed a certain amount of time in the future.
|
| | | @param millis The approximate number of milliseconds to wait before the
|
| | | task will be finished (with result == nil).
|
| | | @param token The cancellation token (optional).
|
| | | */
|
| | | + (OBSBFTask<OBSBFVoid> *)taskWithDelay:(int)millis cancellationToken:(nullable OBSBFCancellationToken *)token;
|
| | |
|
| | | /*!
|
| | | Returns a task that will be completed after the given block completes with
|
| | | the specified executor.
|
| | | @param executor A OBSBFExecutor responsible for determining how the
|
| | | continuation block will be run.
|
| | | @param block The block to immediately schedule to run with the given executor.
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | + (instancetype)taskFromExecutor:(OBSBFExecutor *)executor withBlock:(nullable id (^)(void))block;
|
| | |
|
| | | // Properties that will be set on the task once it is completed.
|
| | |
|
| | | /*!
|
| | | The result of a successful task.
|
| | | */
|
| | | @property (nullable, nonatomic, strong, readonly) ResultType result;
|
| | |
|
| | | /*!
|
| | | The error of a failed task.
|
| | | */
|
| | | @property (nullable, nonatomic, strong, readonly) NSError *error;
|
| | |
|
| | | /*!
|
| | | Whether this task has been cancelled.
|
| | | */
|
| | | @property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled;
|
| | |
|
| | | /*!
|
| | | Whether this task has completed due to an error.
|
| | | */
|
| | | @property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted;
|
| | |
|
| | | /*!
|
| | | Whether this task has completed.
|
| | | */
|
| | | @property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed;
|
| | |
|
| | | /*!
|
| | | Enqueues the given block to be run once this task is complete.
|
| | | This method uses a default execution strategy. The block will be
|
| | | run on the thread where the previous task completes, unless the
|
| | | the stack depth is too deep, in which case it will be run on a
|
| | | dispatch queue with default priority.
|
| | | @param block The block to be run once this task is complete.
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithBlock:(OBSBFContinuationBlock)block NS_SWIFT_NAME(continueWith(block:));
|
| | |
|
| | | /*!
|
| | | Enqueues the given block to be run once this task is complete.
|
| | | This method uses a default execution strategy. The block will be
|
| | | run on the thread where the previous task completes, unless the
|
| | | the stack depth is too deep, in which case it will be run on a
|
| | | dispatch queue with default priority.
|
| | | @param block The block to be run once this task is complete.
|
| | | @param cancellationToken The cancellation token (optional).
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithBlock:(OBSBFContinuationBlock)block
|
| | | cancellationToken:(nullable OBSBFCancellationToken *)cancellationToken NS_SWIFT_NAME(continueWith(block:cancellationToken:));
|
| | |
|
| | | /*!
|
| | | Enqueues the given block to be run once this task is complete.
|
| | | @param executor A OBSBFExecutor responsible for determining how the
|
| | | continuation block will be run.
|
| | | @param block The block to be run once this task is complete.
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithExecutor:(OBSBFExecutor *)executor
|
| | | withBlock:(OBSBFContinuationBlock)block NS_SWIFT_NAME(continueWith(executor:block:));
|
| | |
|
| | | /*!
|
| | | Enqueues the given block to be run once this task is complete.
|
| | | @param executor A OBSBFExecutor responsible for determining how the
|
| | | continuation block will be run.
|
| | | @param block The block to be run once this task is complete.
|
| | | @param cancellationToken The cancellation token (optional).
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | his method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithExecutor:(OBSBFExecutor *)executor
|
| | | block:(OBSBFContinuationBlock)block
|
| | | cancellationToken:(nullable OBSBFCancellationToken *)cancellationToken
|
| | | NS_SWIFT_NAME(continueWith(executor:block:cancellationToken:));
|
| | |
|
| | | /*!
|
| | | Identical to continueWithBlock:, except that the block is only run
|
| | | if this task did not produce a cancellation or an error.
|
| | | If it did, then the failure will be propagated to the returned
|
| | | task.
|
| | | @param block The block to be run once this task is complete.
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithSuccessBlock:(OBSBFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(block:));
|
| | |
|
| | | /*!
|
| | | Identical to continueWithBlock:, except that the block is only run
|
| | | if this task did not produce a cancellation or an error.
|
| | | If it did, then the failure will be propagated to the returned
|
| | | task.
|
| | | @param block The block to be run once this task is complete.
|
| | | @param cancellationToken The cancellation token (optional).
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithSuccessBlock:(OBSBFContinuationBlock)block
|
| | | cancellationToken:(nullable OBSBFCancellationToken *)cancellationToken
|
| | | NS_SWIFT_NAME(continueOnSuccessWith(block:cancellationToken:));
|
| | |
|
| | | /*!
|
| | | Identical to continueWithExecutor:withBlock:, except that the block
|
| | | is only run if this task did not produce a cancellation, error, or an error.
|
| | | If it did, then the failure will be propagated to the returned task.
|
| | | @param executor A OBSBFExecutor responsible for determining how the
|
| | | continuation block will be run.
|
| | | @param block The block to be run once this task is complete.
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithExecutor:(OBSBFExecutor *)executor
|
| | | withSuccessBlock:(OBSBFContinuationBlock)block NS_SWIFT_NAME(continueOnSuccessWith(executor:block:));
|
| | |
|
| | | /*!
|
| | | Identical to continueWithExecutor:withBlock:, except that the block
|
| | | is only run if this task did not produce a cancellation or an error.
|
| | | If it did, then the failure will be propagated to the returned task.
|
| | | @param executor A OBSBFExecutor responsible for determining how the
|
| | | continuation block will be run.
|
| | | @param block The block to be run once this task is complete.
|
| | | @param cancellationToken The cancellation token (optional).
|
| | | @returns A task that will be completed after block has run.
|
| | | If block returns a OBSBFTask, then the task returned from
|
| | | this method will not be completed until that task is completed.
|
| | | */
|
| | | - (OBSBFTask *)continueWithExecutor:(OBSBFExecutor *)executor
|
| | | successBlock:(OBSBFContinuationBlock)block
|
| | | cancellationToken:(nullable OBSBFCancellationToken *)cancellationToken
|
| | | NS_SWIFT_NAME(continueOnSuccessWith(executor:block:cancellationToken:));
|
| | |
|
| | | /*!
|
| | | Waits until this operation is completed.
|
| | | This method is inefficient and consumes a thread resource while
|
| | | it's running. It should be avoided. This method logs a warning
|
| | | message if it is used on the main thread.
|
| | | */
|
| | | - (void)waitUntilFinished;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | @class OBSBFTask<__covariant ResultType>;
|
| | |
|
| | | /*!
|
| | | A OBSBFTaskCompletionSource represents the producer side of tasks.
|
| | | It is a task that also has methods for changing the state of the
|
| | | task by settings its completion values.
|
| | | */
|
| | | @interface OBSBFTaskCompletionSource<__covariant ResultType> : NSObject
|
| | |
|
| | | /*!
|
| | | Creates a new unfinished task.
|
| | | */
|
| | | + (instancetype)taskCompletionSource;
|
| | |
|
| | | /*!
|
| | | The task associated with this TaskCompletionSource.
|
| | | */
|
| | | @property (nonatomic, strong, readonly) OBSBFTask<ResultType> *task;
|
| | |
|
| | | /*!
|
| | | Completes the task by setting the result.
|
| | | Attempting to set this for a completed task will raise an exception.
|
| | | @param result The result of the task.
|
| | | */
|
| | | - (void)setResult:(nullable ResultType)result NS_SWIFT_NAME(set(result:));
|
| | |
|
| | | /*!
|
| | | Completes the task by setting the error.
|
| | | Attempting to set this for a completed task will raise an exception.
|
| | | @param error The error for the task.
|
| | | */
|
| | | - (void)setError:(NSError *)error NS_SWIFT_NAME(set(error:));
|
| | |
|
| | | /*!
|
| | | Completes the task by marking it as cancelled.
|
| | | Attempting to set this for a completed task will raise an exception.
|
| | | */
|
| | | - (void)cancel;
|
| | |
|
| | | /*!
|
| | | Sets the result of the task if it wasn't already completed.
|
| | | @returns whether the new value was set.
|
| | | */
|
| | | - (BOOL)trySetResult:(nullable ResultType)result NS_SWIFT_NAME(trySet(result:));
|
| | |
|
| | | /*!
|
| | | Sets the error of the task if it wasn't already completed.
|
| | | @param error The error for the task.
|
| | | @returns whether the new value was set.
|
| | | */
|
| | | - (BOOL)trySetError:(NSError *)error NS_SWIFT_NAME(trySet(error:));
|
| | |
|
| | | /*!
|
| | | Sets the cancellation state of the task if it wasn't already completed.
|
| | | @returns whether the new value was set.
|
| | | */
|
| | | - (BOOL)trySetCancelled;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSBaseCategory_h |
| | | #define OBSBaseCategory_h |
| | | #import "OBSBaseConstDefinition.h" |
| | | #import "OBSMTLJSONAdapter.h" |
| | | #import "OBSMTLValueTransformer.h" |
| | | @class OBSBaseNetworkingRequest; |
| | | @class OBSBFTaskCompletionSource; |
| | | |
| | | |
| | | |
| | | @interface NSString (OBS) |
| | | //data to NSString with utf8 encoding |
| | | + (nullable instancetype)obs_initWithDataUTF8:(NSData *)data; |
| | | //OBSHTTPMethod enum to string |
| | | + (nullable instancetype)obs_initWithOBSHTTPMethod:(OBSHTTPMethod) HTTPMethod; |
| | | //url string remove tailing slash |
| | | - (nullable NSString*)obs_removeTailSlash; |
| | | //url string append query string |
| | | //- (nullable NSString*)obs_stringByAppendingQueryStringForURL:(NSDictionary *)queryDict; |
| | | //trim spaces |
| | | - (nullable NSString*)obs_trim; |
| | | |
| | | -(nullable NSString*)stringWithRepeatTimes:(NSInteger) times; |
| | | |
| | | //bool with string |
| | | //-(BOOL) obs_boolWithString; |
| | | //OBSHTTPMethod string to enum |
| | | //- (OBSHTTPMethod)obs_OBSHTTPMethodWithString; |
| | | //OBSBodyType string to enum |
| | | //-(OBSBodyType)obs_OBSBodyTypeWithString; |
| | | //URL encoding |
| | | -(nullable NSString*)obs_stringWithURLEncodingAllowedSet; |
| | | //-(nullable NSString*)obs_stringWithURLEncodingAll; |
| | | //-(nullable NSString*)obs_stringWithURLEncodingAllowedAlphanumeric; |
| | | //string substitue |
| | | -(nullable NSString*)obs_stringSubstituteWithDict:(NSDictionary*) dict; |
| | | //xml encoding |
| | | //-(nullable NSString*)obs_XMLEncodeString; |
| | | @end |
| | | |
| | | @interface NSDictionary(OBS) |
| | | //-(NSString*)obs_convertDictionaryToXMLWithStartNode:(NSString*)startNode; |
| | | -(NSString*)obs_XMLString; |
| | | - (NSString *)obs_innerXML:(NSInteger) ident; |
| | | - (nullable NSDictionary *)obs_childNodes; |
| | | - (nullable NSDictionary<NSString *, NSString *> *)obs_attributes; |
| | | @end |
| | | |
| | | @interface NSMutableArray(OBS) |
| | | -(id)pop; |
| | | -(void)push:(id)obj; |
| | | @end |
| | | |
| | | @interface NSURLSessionTask(OBS) |
| | | -(OBSBaseNetworkingRequest*)obsNetworkingRequest; |
| | | -(void)setObsNetworkingRequest:(OBSBaseNetworkingRequest*) networkingRequest; |
| | | @end |
| | | |
| | | @interface OBSMTLJSONAdapter(OBS) |
| | | + (NSDictionary *)valueTransformersForModelClass:(Class)modelClass; |
| | | @end |
| | | |
| | | @interface OBSMTLValueTransformer(OBS) |
| | | //+(NSValueTransformer*)obs_mtl_nsnumberIntegerTransformer; |
| | | +(NSValueTransformer*)obs_mtl_nsnumberLongLongTransformer; |
| | | +(NSValueTransformer*)obs_mtl_nsnumberUIntegerTransformer; |
| | | +(NSValueTransformer*)obs_mtl_nsdateRFC1123Transformer; |
| | | +(NSValueTransformer*)obs_mtl_nsdateIOS8601Format3Transformer; |
| | | //+(NSValueTransformer*)obs_mtl_filterNullStringTransformer; |
| | | @end |
| | | #endif /* OBSBaseCategory_h */ |
New file |
| | |
| | | // |
| | | // OBSBaseConstDefinition.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 10/10/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSBaseDefinition_h |
| | | #define OBSBaseDefinition_h |
| | | |
| | | |
| | | static NSString *const OBSSDKVersion =@"3.24.4"; |
| | | |
| | | static NSUInteger const maxConcurrentRequestCountDefault =3; |
| | | |
| | | static NSString *const OBSURLReservedCharacters =@"-_.~!*'();:=@&=+$,/?#[]%"; |
| | | static NSString *const OBSURLAllowedSpecialCharacters =@"-_."; |
| | | |
| | | static NSString *const OBSAbstractClassPrefix =@"OBSAbstract"; |
| | | #pragma mark - Errors messages; |
| | | static NSString *const OBSClientErrorDomain =@"com.obs.clientError"; |
| | | static NSString *const OBSServerErrorDomain =@"com.obs.serverError"; |
| | | static NSString *const OBSErrorMessageTOKEN =@"ErrorMessage"; |
| | | static NSString *const OBSClientErrorHTTPRequestIDKey =@"RequestID"; |
| | | static NSString *const OBSClientErrorHTTPCodeKey =@"HTTPErrorCode"; |
| | | static NSString *const OBSClientErrorHTTPBodyKey =@"HTTPErrorBody"; |
| | | static NSString *const OBSClientErrorInvalidParameter =@"InvalidParameter"; |
| | | |
| | | static char *const OBSProcessorsQueueName ="com.obs.sdk.processors"; |
| | | static NSString *const OBSMaxConcurrentCommandRequestCountKey =@"maxConcurrentCommandRequestCount"; |
| | | static NSString *const OBSMaxConcurrentUploadRequestCountKey =@"maxConcurrentUploadRequestCount"; |
| | | static NSString *const OBSMaxConcurrentDownloadRequestCountKey =@"maxConcurrentDownloadRequestCount"; |
| | | |
| | | static NSString *const OBSUploadBackgroundIdentifierDefault =@"com.obs.sdk.upload"; |
| | | static NSString *const OBSDownloadBackgroundIdentifierDefault =@"com.obs.sdk.download"; |
| | | |
| | | //networking request definition dict keys; |
| | | //common fields; |
| | | static NSString *const OBSRequestTypeKey =@"requestType"; |
| | | static NSString *const OBSRequestIDKey =@"requestID"; |
| | | static NSString *const OBSRequestHTTPMethodKey =@"requestMethod"; |
| | | static NSString *const OBSRequestResourceStringKey =@"requestResourceString"; |
| | | static NSString *const OBSRequestResourceParametersKey =@"requestResourceParameters"; |
| | | static NSString *const OBSRequestQueryParametersKey =@"requestQueryParameters"; |
| | | static NSString *const OBSRequestHeaderParametersKey =@"requestHeadersParameters"; |
| | | |
| | | static NSString *const OBSRequestBodyParameterKey =@"requestBodyParameters"; |
| | | static NSString *const OBSRequestAddonRequestPostProcessorsKey =@"addonRequestPostProcessorsParameters"; |
| | | static NSString *const OBSRequestAddonResponsePreProcessorsKey =@"addonResponsePreProcessorsParameters"; |
| | | static NSString *const OBSRequestAuthRequiredKey =@"authenticationRequired"; |
| | | //upload data fields; |
| | | static NSString *const OBSRequestUploadDataKey =@"uploadData"; |
| | | static NSString *const OBSRequestUploadProgressBlockKey =@"uploadProgressBlock"; |
| | | //download data fields; |
| | | static NSString *const OBSRequestOnReceiveDataBlockKey =@"onReceiveDataBlock"; |
| | | static NSString *const OBSRequestDownloadProgressBlockKey =@"downloadProgressBlock"; |
| | | //upload and download fields; |
| | | static NSString *const OBSRequestUploadFilePathKey =@"uploadFilePath"; |
| | | static NSString *const OBSRequestDownloadFilePathKey =@"downloadFilePath"; |
| | | static NSString *const OBSRequestBackgroundKey =@"background"; |
| | | // headesr key; |
| | | static NSString *const OBSHeadersUAKey =@"User-Agent"; |
| | | |
| | | static NSString *const OBSHeadersHostKey =@"Host"; |
| | | static NSString *const OBSHeadersContentTypeKey =@"Content-Type"; |
| | | static NSString *const OBSHeadersContentLengthKey =@"Content-Length"; |
| | | static NSString *const OBSHeadersAuthorizationKey =@"Authorization"; |
| | | static NSString *const OBSDefaultContentType =@"binary/octet-stream"; |
| | | //date format; |
| | | static NSString *const OBSDateShortFormat =@"yyyyMMdd"; |
| | | static NSString *const OBSDateRFC1123Format =@"E, dd MMM yyyy HH:mm:ss z"; |
| | | static NSString *const OBSDateISO8601Format1 =@"yyyy-MM-dd'T'HH:mm:ss'Z'"; |
| | | static NSString *const OBSDateISO8601Format2 =@"yyyyMMdd'T'HHmmss'Z'" ; |
| | | static NSString *const OBSDateISO8601Format3 =@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; |
| | | //output keys and download temp file extention; |
| | | static NSString *const OBSOutputCodeKey =@"statusCode"; |
| | | static NSString *const OBSOutputHeadersKey =@"headers"; |
| | | static NSString *const OBSOutputBodyKey =@"body"; |
| | | |
| | | |
| | | static NSString *const OBSXMLDefaultNS =@" xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\""; |
| | | static NSString *const OBSXMLDefaultNS_OBS =@" xmlns=\"http://myhwclouds.com/doc/2015-06-30/\""; |
| | | |
| | | static NSString *const OBSXMLDictionaryNodeOrderKey =@"__order"; |
| | | |
| | | #pragma mark -Enum |
| | | /** |
| | | * OBS鉴权版本枚举 |
| | | */ |
| | | |
| | | typedef NS_ENUM(NSInteger, OBSContentType) { |
| | | /** |
| | | * 默认类型 |
| | | */ |
| | | OBSContentTypeNULL0, |
| | | /** |
| | | * mp4 |
| | | */ |
| | | OBSContentTypeMP4, |
| | | /** |
| | | * 二进制流 |
| | | */ |
| | | OBSContentTypeBinary, |
| | | /** |
| | | * JPEG |
| | | */ |
| | | OBSContentTypeJPEG, |
| | | /** |
| | | * PNG |
| | | */ |
| | | OBSContentTypePNG, |
| | | /** |
| | | * HTML |
| | | */ |
| | | OBSContentTypeHTML, |
| | | /** |
| | | * GIF |
| | | */ |
| | | OBSContentTypeGIF, |
| | | /** |
| | | * PDF |
| | | */ |
| | | OBSContentTypePDF, |
| | | /** |
| | | * MP3 |
| | | */ |
| | | OBSContentTypeMP3, |
| | | /** |
| | | * WAV |
| | | */ |
| | | OBSContentTypeWAV, |
| | | /** |
| | | * MOV |
| | | */ |
| | | OBSContentTypeMOV, |
| | | /** |
| | | * m3u8 |
| | | */ |
| | | OBSContentTypeM3U8, |
| | | }; |
| | | |
| | | typedef NS_ENUM(NSInteger, OBSAuthVersion) { |
| | | /** |
| | | * 默认鉴权 |
| | | */ |
| | | OBSAuthVersionNULL0, |
| | | /** |
| | | * V2鉴权 |
| | | */ |
| | | OBSAuthVersionV2, |
| | | /** |
| | | * V4鉴权 |
| | | */ |
| | | OBSAuthVersionV4, |
| | | }; |
| | | |
| | | /** |
| | | * OBS协议种类 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSProtocolType) { |
| | | |
| | | /** |
| | | * 旧版本协议 |
| | | */ |
| | | OBSProtocolTypeOld, |
| | | /** |
| | | * 自研协议 |
| | | */ |
| | | OBSProtocolTypeOBS, |
| | | }; |
| | | |
| | | /** |
| | | * OBS错误码枚举 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSErrorCode) { |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSErrorCodeNoErrorCode0, |
| | | /** |
| | | * 服务器错误 |
| | | */ |
| | | OBSErrorCodeServerErrorStatus, |
| | | /** |
| | | * 客户端错误 |
| | | */ |
| | | OBSErrorCodeClientErrorStatus, |
| | | }; |
| | | |
| | | /** |
| | | * OBS客户端错误码枚举 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSClientErrorCODE) { |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSRequestNoErrorCode0, |
| | | /** |
| | | * 定义未找到 |
| | | */ |
| | | OBSClientErrorRequestDefinitionNotFoundCode, |
| | | /** |
| | | * 响应错误码 |
| | | */ |
| | | OBSClientErrorHTTPResponseCodeError, |
| | | /** |
| | | * 签名错误 |
| | | */ |
| | | OBSClientErrorCodeSignFailed, |
| | | // OBSClientErrorCodeNetworkingFailWithResponseCode0, |
| | | // OBSClientErrorCodeFileCantWrite, |
| | | // OBSClientErrorCodeInvalidArgument, |
| | | // OBSClientErrorCodeNilUploadid, |
| | | // OBSClientErrorCodeTaskCancelled, |
| | | // OBSClientErrorCodeNetworkError, |
| | | // OBSClientErrorCodeCannotResumeUpload, |
| | | // OBSClientErrorCodeExcpetionCatched, |
| | | // OBSClientErrorCodeNotKnown |
| | | }; |
| | | |
| | | /** |
| | | * OBS请求代理类型 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSHTTPProxyType) { |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSHTTPRroxyTypeNull0, |
| | | /** |
| | | * HTTP |
| | | */ |
| | | OBSHTTPRroxyTypeHTTP, |
| | | /** |
| | | * HTTPS |
| | | */ |
| | | OBSHTTPRroxyTypeHTTPS, |
| | | /** |
| | | * HTTP & HTTPS |
| | | */ |
| | | OBSHTTPRroxyTypeHTTPAndHTTPS, |
| | | }; |
| | | |
| | | /** |
| | | * 请求类型 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSRequestType){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSRequestTypeNull0, |
| | | /** |
| | | * 命令 |
| | | */ |
| | | OBSRequestTypeCommandRequest, |
| | | /** |
| | | * 上传数据 |
| | | */ |
| | | OBSRequestTypeUploadDataRequest, |
| | | /** |
| | | * 上传文件 |
| | | */ |
| | | OBSRequestTypeUploadFileRequest, |
| | | /** |
| | | * 下载数据 |
| | | */ |
| | | OBSRequestTypeDownloadDataRequest, |
| | | /** |
| | | * 下载文件 |
| | | */ |
| | | OBSRequestTypeDownloadFileRequest, |
| | | }; |
| | | |
| | | /** |
| | | * 请求体内容 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSBodyType){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSBodyTypeNull0, |
| | | /** |
| | | * JSON |
| | | */ |
| | | OBSBodyTypeJSON, |
| | | /** |
| | | * XML |
| | | */ |
| | | OBSBodyTypeXML, |
| | | /** |
| | | * 字符串 |
| | | */ |
| | | OBSBodyTypeStringData, |
| | | }; |
| | | /** |
| | | * 请求方法类型枚举 |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSHTTPMethod){ |
| | | OBSHTTPMethodNull0, |
| | | OBSHTTPMethodGET, |
| | | OBSHTTPMethodHEAD, |
| | | OBSHTTPMethodPUT, |
| | | OBSHTTPMethodPOST, |
| | | OBSHTTPMethodTRACE, |
| | | OBSHTTPMethodOPTIONS, |
| | | OBSHTTPMethodDELETE, |
| | | OBSHTTPMethodLOCK, |
| | | OBSHTTPMethodMKCOL, |
| | | OBSHTTPMethodMOVE, |
| | | }; |
| | | |
| | | |
| | | #pragma mark - ignore warn |
| | | #define SuppressPerformSelectorLeakWarning(code) \ |
| | | _Pragma("clang diagnostic push") \ |
| | | _Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \ |
| | | code\ |
| | | _Pragma("clang diagnostic pop") \ |
| | | |
| | | #define SuppressMethodDefinitionNotFoundWarning(code) \ |
| | | _Pragma("clang diagnostic push") \ |
| | | _Pragma("clang diagnostic ignored \"-Wincomplete-implementation\"") \ |
| | | code\ |
| | | _Pragma("clang diagnostic pop") \ |
| | | |
| | | #define MakeDispatchOnceDictBEGIN \ |
| | | static NSDictionary *dict; \ |
| | | static dispatch_once_t onceToken; \ |
| | | dispatch_once(&onceToken, ^{ |
| | | |
| | | #define MakeDispatchOnceDictEND\ |
| | | }); \ |
| | | |
| | | |
| | | #define MakeDispatchOnceArrayBEGIN \ |
| | | static NSArray *array; \ |
| | | static dispatch_once_t onceToken; \ |
| | | dispatch_once(&onceToken, ^{ |
| | | |
| | | #define MakeDispatchOnceArrayEND\ |
| | | }); \ |
| | | |
| | | #define MakeDispatchOnceTransformerBEGIN \ |
| | | static NSValueTransformer *transformer; \ |
| | | static dispatch_once_t onceToken; \ |
| | | dispatch_once(&onceToken, ^{ |
| | | |
| | | #define MakeDispatchOnceTransformerEND \ |
| | | }); \ |
| | | |
| | | |
| | | #define metamacro_concat(A,B) A ## B |
| | | #define weakify(VAR) \ |
| | | autoreleasepool {} \ |
| | | __weak __typeof__(VAR) weak##VAR = VAR |
| | | // __weak __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR) |
| | | |
| | | #define strongify(VAR) \ |
| | | autoreleasepool {} \ |
| | | _Pragma("clang diagnostic push") \ |
| | | _Pragma("clang diagnostic ignored \"-Wshadow\"") \ |
| | | __strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_)\ |
| | | _Pragma("clang diagnostic pop") \ |
| | | |
| | | #pragma mark - Progress block |
| | | typedef void (^OBSNetworkingUploadProgressBlock) (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); |
| | | typedef void (^OBSNetworkingDownloadProgressBlock) (int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); |
| | | typedef void (^OBSNetworkingOnReceiveDataBlock)(NSData *data); |
| | | #endif /* OBSConstDefinition_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSBaseModel_h |
| | | #define OBSBaseModel_h |
| | | |
| | | #import "OBSBaseCategory.h" |
| | | #import "OBSBaseConstDefinition.h" |
| | | #import "OBSMantle.h" |
| | | #import "OBSXMLDictionary.h" |
| | | |
| | | @class OBSRequestConverter; |
| | | @protocol OBSNetworkingRequestPostProcessor; |
| | | |
| | | //#pragma mark - OBSSafeMutableDictionary |
| | | //@interface OBSSafeMutableDictionary<KeyType, ObjectType>:NSMutableDictionary |
| | | //- (id) objectForKey:(id)aKey; |
| | | //- (void)setObject:(ObjectType)anObject forKey:(KeyType <NSCopying>) aKey; |
| | | //- (void)removeObjectForKey:(KeyType)aKey; |
| | | //@end |
| | | //#pragma mark - OBSOrderedMutableDictionary |
| | | //@interface OBSOrderedMutableDictionary<KeyType, ObjectType>:NSMutableDictionary |
| | | //- (id) objectForKey:(id)aKey; |
| | | //- (void)setObject:(ObjectType)anObject forKey:(KeyType <NSCopying>) aKey; |
| | | //- (void)removeObjectForKey:(KeyType)aKey; |
| | | //- (NSEnumerator*)keyEnumerator; |
| | | //- (NSUInteger)count; |
| | | //@end |
| | | |
| | | #pragma mark - OBSWeakMutableArray |
| | | @interface OBSWeakMutableArray<ObjectType>:NSMutableArray |
| | | -(instancetype)initWithCapacity:(NSUInteger)numItems; |
| | | -(NSUInteger)count; |
| | | -(void)addObject:(id)anObject; |
| | | -(void)removeObject:(id)anObject; |
| | | -(void)removeObjectAtIndex:(NSUInteger)index; |
| | | -(id)objectAtIndex:(NSUInteger)index; |
| | | @end |
| | | |
| | | @protocol OBSGetBodyTypeProtocol<NSObject> |
| | | +(OBSBodyType)GetBodyType; |
| | | @end |
| | | |
| | | #pragma mark configuration |
| | | @interface OBSHTTPProxyConfiguration : NSObject |
| | | @property (nonatomic, assign) OBSHTTPProxyType proxyType; |
| | | @property (nonatomic, strong, nonnull) NSString *proxyHost; |
| | | @property (nonatomic, strong, nonnull) NSNumber *proxyPort; |
| | | @property (nonatomic, strong, nonnull) NSString *username; |
| | | @property (nonatomic, strong, nonnull) NSString *password; |
| | | |
| | | /** |
| | | 端口代理初始化 |
| | | |
| | | @param proxyType 请求类型(OBSHTTPRroxyTypeNull0 OBSHTTPRroxyTypeHTTP OBSHTTPRroxyTypeHTTPS OBSHTTPRroxyTypeHTTPAndHTTPS) |
| | | @param host host |
| | | @param port port |
| | | @return 代理对象 |
| | | */ |
| | | -(instancetype)initWithType:(OBSHTTPProxyType) proxyType proxyHost:(NSString*) host proxyPort:(NSUInteger) port; |
| | | -(NSDictionary*) getProxyDict; |
| | | @end |
| | | |
| | | @interface OBSBaseConfiguration : NSObject |
| | | @property (nonatomic, strong, readonly, nonnull) NSURL *url; |
| | | @property (nonatomic, strong) NSString *lastUploadPath; |
| | | @property (nonatomic, strong) NSData *uploadAllData; |
| | | @property (nonatomic, assign) BOOL trustUnsafeCert; |
| | | @property (nonatomic, assign) uint32_t maxConcurrentCommandRequestCount; |
| | | @property (nonatomic, assign) uint32_t maxConcurrentUploadRequestCount; |
| | | @property (nonatomic, assign) uint32_t maxConcurrentDownloadRequestCount; |
| | | |
| | | @property (nonatomic, strong) NSURLSessionConfiguration * commandSessionConfiguration; |
| | | @property (nonatomic, strong) NSURLSessionConfiguration * uploadSessionConfiguration; |
| | | @property (nonatomic, strong) NSURLSessionConfiguration * downloadSessionConfiguration; |
| | | @property (nonatomic, strong) NSURLSessionConfiguration * backgroundUploadSessionConfiguration; |
| | | @property (nonatomic, strong) NSURLSessionConfiguration * backgroundDownloadSessionConfiguration; |
| | | |
| | | @property (nonatomic, strong) OBSHTTPProxyConfiguration * proxyConfig; |
| | | @property (nonatomic, strong) NSMutableArray<id<OBSNetworkingRequestPostProcessor>> * customProcessors; |
| | | @property (nonatomic, assign) BOOL enableURLEncoding; |
| | | -(instancetype) initWithURL:(NSURL*) url; |
| | | -(NSArray*)getDefaultPostProcessors; |
| | | @end |
| | | |
| | | #pragma mark MTLJSONAdaptor and XML Parser |
| | | |
| | | @protocol OBSMTLDictionaryItemOrderProtocol <NSObject> |
| | | @required |
| | | +(NSArray*)DictionaryOrderList; |
| | | @end |
| | | |
| | | @interface OBSMTLJSONAdapterCustomized: OBSMTLJSONAdapter |
| | | |
| | | -(void)setModelClass:(Class)clazz; |
| | | -(Class)modelClass; |
| | | |
| | | -(void)setJSONKeyPathsByPropertyKey:(NSDictionary*)dict; |
| | | -(NSDictionary*)JSONKeyPathsByPropertyKey; |
| | | |
| | | -(void)setValueTransformersByPropertyKey:(NSDictionary*)dict; |
| | | -(NSDictionary*)valueTransformersByPropertyKey; |
| | | |
| | | -(void)setJSONAdaptersByModelClass:(NSMapTable*)dict; |
| | | -(NSMapTable*)JSONAdaptersByModelClass; |
| | | |
| | | - (OBSMTLJSONAdapter *)JSONAdapterForModelClass:(Class)modelClass error:(NSError **)error; |
| | | @end |
| | | |
| | | @interface OBSXMLDictionaryParserWithFormat: OBSXMLDictionaryParser |
| | | + (NSString *)OBSXMLStringForNode:(id)node withNodeName:(NSString *)nodeName ident:(NSInteger) ident; |
| | | - (void)endText; |
| | | -(void)setRoot:(NSMutableDictionary<NSString *, id>*) root; |
| | | -(NSMutableDictionary<NSString *, id>*)root; |
| | | -(void)setStack:(NSMutableArray*) stack; |
| | | -(NSMutableArray*)stack; |
| | | @end |
| | | |
| | | #pragma mark - Base Model |
| | | |
| | | |
| | | @protocol OBSRequestConvert |
| | | @required |
| | | -(OBSBaseNetworkingRequest*)convertToNetworkingRequest:(OBSBaseConfiguration*) configuration error:(NSError**) error; |
| | | @end |
| | | |
| | | @interface OBSAbstractModel : OBSMTLModel<OBSMTLJSONSerializing> |
| | | @end |
| | | |
| | | @interface OBSBaseEntity: OBSAbstractModel |
| | | @end |
| | | |
| | | @interface OBSResponseHeaderEntity: OBSBaseEntity |
| | | @end |
| | | |
| | | @interface OBSResponseURLEntity: OBSBaseEntity |
| | | @end |
| | | |
| | | @interface OBSResponseBodyEntity: OBSBaseEntity |
| | | @end |
| | | |
| | | #pragma mark - Base Requests |
| | | |
| | | |
| | | /** |
| | | OBS网络请求基类 |
| | | */ |
| | | @interface OBSBaseRequest: OBSAbstractModel<OBSRequestConvert> |
| | | |
| | | /** |
| | | 请求ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *requestID; |
| | | |
| | | /** |
| | | 是否取消 |
| | | */ |
| | | @property (readonly, nonatomic, assign) BOOL isCancelled; |
| | | |
| | | /** |
| | | 请求类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSProtocolType protocolType; |
| | | |
| | | |
| | | /** |
| | | 取消请求 |
| | | */ |
| | | -(void)cancel; |
| | | |
| | | /** |
| | | 判断是否是一个合法的请求 |
| | | |
| | | @param error 抛出的错误 |
| | | @return 返回是否为合法请求 |
| | | */ |
| | | -(BOOL)validateRequest:(NSError**)error; |
| | | @end |
| | | |
| | | #pragma mark - Base Response |
| | | |
| | | /** |
| | | OBS网络响应基类 |
| | | */ |
| | | @interface OBSBaseResponse: OBSAbstractModel<OBSGetBodyTypeProtocol> |
| | | |
| | | /** |
| | | 响应状态码 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *statusCode; |
| | | |
| | | /** |
| | | 响应头部 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *headers; |
| | | |
| | | /** |
| | | 请求ID |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *requestID; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSBaseModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSBaseNetworking_h |
| | | #define OBSBaseNetworking_h |
| | | #import "OBSBaseConstDefinition.h" |
| | | #import "OBSBaseModel.h" |
| | | @class OBSBFTaskCompletionSource; |
| | | @class OBSBFTask; |
| | | @class OBSBaseRequest; |
| | | @class OBSEndpoint; |
| | | @class OBSBaseNetworkingRequest; |
| | | @class OBSBaseConfiguration; |
| | | @class OBSAbstractCredentailProvider; |
| | | @protocol NSURLSessionDelegate; |
| | | @protocol NSURLSessionDataDelegate; |
| | | @protocol OBSServiceCredentialProvider; |
| | | |
| | | #pragma mark - Networking classes |
| | | |
| | | @protocol OBSNetworkingRequestPostProcessor<NSObject> |
| | | @required |
| | | +(void)processRequest:(OBSBaseNetworkingRequest*) request configuration:(__kindof OBSBaseConfiguration *const) configuration error:(NSError**) error; |
| | | @end |
| | | |
| | | @protocol OBSNetworkingResponsePreProcessor<NSObject> |
| | | @required |
| | | +(void)processResponse:(NSMutableDictionary*) responseDict configuration:(__kindof OBSBaseConfiguration *const) configuration error:(NSError**) error; |
| | | @end |
| | | |
| | | @interface OBSRequestURLStringPostProcessor: NSObject<OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSResouceParameterPostProcessor: NSObject<OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSHeaderUAPostProcessor: NSObject <OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSHeaderContentLengthPostProcessor: NSObject <OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSHeaderContentTypePostProcessor: NSObject <OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSHeaderHostPostProcessor: NSObject <OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSURLEncodingPostProcessor: NSObject <OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @protocol OBSNetworkingRequestJSONDataProtocol<NSObject> |
| | | @required |
| | | +(NSDictionary*) AdditionalJSONData; |
| | | +(NSDictionary*) getAdditionalJSONDataIncludeParents; |
| | | @end |
| | | |
| | | #pragma mark - Networking Manager |
| | | @interface OBSNetworkingManager :NSObject<NSURLSessionDelegate, NSURLSessionTaskDelegate,NSURLSessionDataDelegate,NSURLSessionDownloadDelegate> |
| | | @property (nonatomic, readonly, nonnull) OBSBaseConfiguration *configuration; |
| | | -(instancetype) initWithConfiguration:(OBSBaseConfiguration*) configuration; |
| | | -(OBSBFTask*) sendRequest: (OBSBaseNetworkingRequest*) request; |
| | | -(void)releaseSessions; |
| | | @end |
| | | |
| | | #pragma mark - networking base requests |
| | | |
| | | @protocol OBSNetworkingGetResponseClazz |
| | | @optional |
| | | -(Class)getResponseClazz; |
| | | @end |
| | | |
| | | @interface OBSBaseNetworkingRequest : OBSAbstractModel<OBSNetworkingGetResponseClazz> |
| | | //config |
| | | @property (nonatomic, assign) OBSRequestType requestType; |
| | | @property (nonatomic, copy, nonnull) NSString *requestID; |
| | | @property (nonatomic, assign) OBSHTTPMethod requestMethod; |
| | | @property (nonatomic, strong, nullable) NSString *requestBaseURLString; |
| | | @property (nonatomic, strong, nullable) NSString *requestResourceString; |
| | | @property (nonatomic, strong, nullable) NSString *requestOriginalResourceString; |
| | | @property (nonatomic, strong, nullable) NSMutableDictionary *requestResourceParameters; |
| | | @property (nonatomic, strong, nullable) NSMutableDictionary *requestQueryParameters; |
| | | @property (nonatomic, strong, nullable) NSMutableDictionary *requestHeadersParameters; |
| | | @property (nonatomic, strong, nullable) NSMutableArray *addonRequestPostProcessorsParameters; |
| | | @property (nonatomic, strong, nullable) NSMutableArray *addonResponsePreProcessorsParameters; |
| | | |
| | | //processing attribute |
| | | @property (nonatomic, strong, nullable) NSData *requestBodyData; |
| | | @property (nonatomic, strong, nullable) NSMutableData *responseData; |
| | | @property (nonatomic, strong) NSMutableArray<Class<OBSNetworkingRequestPostProcessor>> *postProcessors; |
| | | @property (nonatomic, strong) NSMutableArray<Class<OBSNetworkingResponsePreProcessor>> *preProcessors; |
| | | @property (nonatomic, strong, nullable) OBSWeakMutableArray<NSURLSessionTask*> *sessionTaskList; |
| | | @property (nonatomic, strong) OBSBFTaskCompletionSource *completionSource; |
| | | @property (nonatomic, weak, nullable) OBSBaseRequest *obsRequest; |
| | | @property (readonly, nonatomic, assign) BOOL isCancelled; |
| | | -(void)cancel; |
| | | @end |
| | | |
| | | @interface OBSNetworkingCommandRequest : OBSBaseNetworkingRequest<OBSNetworkingRequestJSONDataProtocol, OBSGetBodyTypeProtocol> |
| | | @property (nonatomic, strong, nullable) NSMutableDictionary *requestBodyParameters; |
| | | @end |
| | | |
| | | @interface OBSNetworkingUploadDataRequest : OBSBaseNetworkingRequest<OBSNetworkingRequestJSONDataProtocol> |
| | | @property (nonatomic, strong, nonnull) NSData *uploadData; |
| | | @property (nonatomic, copy, nullable) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | @end |
| | | |
| | | @interface OBSNetworkingUploadFileRequest : OBSBaseNetworkingRequest<OBSNetworkingRequestJSONDataProtocol> |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | @property (nonatomic, assign) BOOL background; |
| | | @property (nonatomic, copy, nullable) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | @end |
| | | |
| | | @interface OBSNetworkingDownloadDataRequest : OBSBaseNetworkingRequest<OBSNetworkingRequestJSONDataProtocol> |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingOnReceiveDataBlock onReceiveDataBlock; |
| | | @property (nonatomic, copy) OBSNetworkingDownloadProgressBlock downloadProgressBlock; |
| | | @property (nonatomic, assign) int64_t bytes_totalGot; |
| | | |
| | | @end |
| | | |
| | | @interface OBSNetworkingDownloadFileRequest : OBSBaseNetworkingRequest<OBSNetworkingRequestJSONDataProtocol> |
| | | @property (nonatomic, assign) BOOL background; |
| | | @property (nonatomic, strong, nonnull) NSString * downloadFilePath; |
| | | @property (nonatomic, copy) OBSNetworkingDownloadProgressBlock downloadProgressBlock; |
| | | @end |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #endif /* OBSBaseNetworking_h */ |
New file |
| | |
| | | /*
|
| | | * Copyright (c) 2014, Facebook, Inc.
|
| | | * All rights reserved.
|
| | | *
|
| | | * This source code is licensed under the BSD-style license found in the
|
| | | * LICENSE file in the root directory of this source tree. An additional grant
|
| | | * of patent rights can be found in the PATENTS file in the same directory.
|
| | | *
|
| | | */
|
| | |
|
| | | #import "OBSBFCancellationToken.h"
|
| | | #import "OBSBFCancellationTokenRegistration.h"
|
| | | #import "OBSBFCancellationTokenSource.h"
|
| | | #import "OBSBFExecutor.h"
|
| | | #import "OBSBFGeneric.h"
|
| | | #import "OBSBFTask.h"
|
| | | #import "OBSBFTaskCompletionSource.h"
|
| | |
|
| | | #if __has_include("OBSBFAppLink.h") && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV
|
| | | #import "OBSBFAppLink.h"
|
| | | #import "OBSBFAppLinkNavigation.h"
|
| | | #import "OBSBFAppLinkResolving.h"
|
| | | #import "OBSBFAppLinkReturnToRefererController.h"
|
| | | #import "OBSBFAppLinkReturnToRefererView.h"
|
| | | #import "OBSBFAppLinkTarget.h"
|
| | | #import "OBSBFMeasurementEvent.h"
|
| | | #import "OBSBFURL.h"
|
| | | #import "OBSBFWebViewAppLinkResolver.h"
|
| | | #endif
|
| | |
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /**
|
| | | A string containing the version of the Bolts Framework used by the current application.
|
| | | */
|
| | | FOUNDATION_EXPORT NSString *const OBSBoltsFrameworkVersionString;
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #import <QuartzCore/QuartzCore.h>
|
| | |
|
| | | /**
|
| | | *This class represents an NSColor replacement for CLI projects that don't link with AppKit
|
| | | **/
|
| | | @interface OBSCLIColor : NSObject
|
| | |
|
| | | /**
|
| | | * Convenience method for creating a `OBSCLIColor` instance from RGBA params
|
| | | *
|
| | | * @param red red channel, between 0 and 1
|
| | | * @param green green channel, between 0 and 1
|
| | | * @param blue blue channel, between 0 and 1
|
| | | * @param alpha alpha channel, between 0 and 1
|
| | | */
|
| | | + (OBSCLIColor *)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
|
| | |
|
| | | /**
|
| | | * Get the RGBA components from a `OBSCLIColor`
|
| | | *
|
| | | * @param red red channel, between 0 and 1
|
| | | * @param green green channel, between 0 and 1
|
| | | * @param blue blue channel, between 0 and 1
|
| | | * @param alpha alpha channel, between 0 and 1
|
| | | */
|
| | | - (void)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha NS_SWIFT_NAME(get(red:green:blue:alpha:));
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSClient_h |
| | | #define OBSClient_h |
| | | #import "OBSLogging.h" |
| | | |
| | | @class OBSBaseRequest; |
| | | @class OBSBFTask; |
| | | @class OBSBaseConfiguration; |
| | | @class OBSRequestConverter; |
| | | |
| | | |
| | | @interface OBSClient:NSObject |
| | | @property (nonatomic, strong, nonnull) OBSBaseConfiguration *configuration; |
| | | |
| | | |
| | | #pragma mark - init |
| | | |
| | | /** |
| | | client初始化 |
| | | |
| | | @param configuration 配置参数 |
| | | @return client对象 |
| | | */ |
| | | -(instancetype) initWithConfiguration: (__kindof OBSBaseConfiguration*) configuration; |
| | | |
| | | #pragma mark - set logger |
| | | /* *Set log level, default level is info. |
| | | log levels are: |
| | | OBSDDLogLevelOff |
| | | OBSDDLogLevelError |
| | | OBSDDLogLevelWarning |
| | | OBSDDLogLevelInfo |
| | | OBSDDLogLevelDebug |
| | | OBSDDLogLevelVerbose |
| | | */ |
| | | |
| | | /** |
| | | 设置日志等级 |
| | | |
| | | @param logLevel 日志种类 |
| | | OBSDDLogLevelOff |
| | | OBSDDLogLevelError |
| | | OBSDDLogLevelWarning |
| | | OBSDDLogLevelInfo |
| | | OBSDDLogLevelDebug |
| | | OBSDDLogLevelVerbose |
| | | */ |
| | | -(void) setLogLevel:(OBSDDLogLevel) logLevel; |
| | | |
| | | /** |
| | | *Add custom logger, such as file logger |
| | | */ |
| | | |
| | | |
| | | /** |
| | | 添加日志logger |
| | | |
| | | @param logger 日志logger类型 |
| | | */ |
| | | -(void) addLogger: (id <OBSDDLogger>) logger; |
| | | |
| | | |
| | | /** |
| | | *Set Apple System Logger on, after turnning on this log could be seeing in the system's console app. |
| | | */ |
| | | |
| | | /** |
| | | 开启窗口日志打印 |
| | | */ |
| | | -(void) setASLogOn; |
| | | |
| | | - (OBSBFTask*)invokeRequest:(OBSBaseRequest *) request; |
| | | -(BOOL)getOBSProtocol:(OBSBaseRequest *)request; |
| | | @end |
| | | |
| | | #endif /* OBSClient_h */ |
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | /**
|
| | | *Welcome to CocoaLumberjack!
|
| | | *
|
| | | *The project page has a wealth of documentation if you have any questions.
|
| | | *https://github.com/CocoaLumberjack/CocoaLumberjack
|
| | | *
|
| | | *If you're new to the project you may wish to read "Getting Started" at:
|
| | | *Documentation/GettingStarted.md
|
| | | *
|
| | | *Otherwise, here is a quick refresher.
|
| | | *There are three steps to using the macros:
|
| | | *
|
| | | *Step 1:
|
| | | *Import the header in your implementation or prefix file:
|
| | | *
|
| | | *#import <CocoaLumberjack/CocoaLumberjack.h>
|
| | | *
|
| | | *Step 2:
|
| | | *Define your logging level in your implementation file:
|
| | | *
|
| | | // Log levels: off, error, warn, info, verbose
|
| | | *static const OBSDDLogLevel obsddLogLevel = OBSDDLogLevelVerbose;
|
| | | *
|
| | | *Step 2 [3rd party frameworks]:
|
| | | *
|
| | | *Define your OBSLOG_LEVEL_DEF to a different variable/function than obsddLogLevel:
|
| | | *
|
| | | // #undef OBSLOG_LEVEL_DEF // Undefine first only if needed
|
| | | *#define OBSLOG_LEVEL_DEF myLibLogLevel
|
| | | *
|
| | | *Define your logging level in your implementation file:
|
| | | *
|
| | | // Log levels: off, error, warn, info, verbose
|
| | | *static const OBSDDLogLevel myLibLogLevel = OBSDDLogLevelVerbose;
|
| | | *
|
| | | *Step 3:
|
| | | *Replace your NSLog statements with OBSDDLog statements according to the severity of the message.
|
| | | *
|
| | | *NSLog(@"Fatal error, no dohickey found!"); -> OBSDDLogError(@"Fatal error, no dohickey found!");
|
| | | *
|
| | | *OBSDDLog works exactly the same as NSLog.
|
| | | *This means you can pass it multiple variables just like NSLog.
|
| | | **/
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
| | |
|
| | | FOUNDATION_EXPORT NSString *const OBSCocoaLumberjackFrameworkVersionString;
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | // Core
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | // Main macros
|
| | | #import "OBSDDLogMacros.h"
|
| | | #import "OBSDDAssertMacros.h"
|
| | |
|
| | | // Capture ASL
|
| | | #import "OBSDDASLLogCapture.h"
|
| | |
|
| | | // Loggers
|
| | | #import "OBSDDTTYLogger.h"
|
| | | #import "OBSDDASLLogger.h"
|
| | | #import "OBSDDFileLogger.h"
|
| | | #import "OBSDDOSLogger.h"
|
| | |
|
| | | // CLI
|
| | | #if __has_include("OBSCLIColor.h") && TARGET_OS_OSX
|
| | | #import "OBSCLIColor.h"
|
| | | #endif
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSCompleteMultipartUploadModel_h |
| | | #define OBSCompleteMultipartUploadModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 合并段 |
| | | */ |
| | | @protocol OBSCompleteMultipartUploadProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 多段任务列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSPart*> *partsList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 合并段request |
| | | */ |
| | | @interface OBSCompleteMultipartUploadRequest : OBSBaseRequest<OBSCompleteMultipartUploadProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 多段上传对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSPart*> *partsList; |
| | | |
| | | /** |
| | | 初始化合并段request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象名 |
| | | @param uploadID 多段上传任务ID |
| | | @return 合并段request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadID:(NSString*) uploadID; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingCompleteMultipartUploadRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 合并段response |
| | | */ |
| | | @interface OBSCompleteMultipartUploadResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 区域位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *location; |
| | | |
| | | /** |
| | | 对象etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(completeMultipartUpload) |
| | | |
| | | /** |
| | | 合并段 |
| | | |
| | | @param request 合并段request |
| | | @param completionHandler 合并段回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)completeMultipartUpload:(__kindof OBSBaseRequest<OBSCompleteMultipartUploadProtocol>*)request |
| | | completionHandler:(void (^)(OBSCompleteMultipartUploadResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSCompleteMultipartUploadModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSCopyObjectModel_h |
| | | #define OBSCopyObjectModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | @class OBSEncryptionTypeCustomer; |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 复制对象 |
| | | */ |
| | | @protocol OBSCopyObjectProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 被复制桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcBucketName; |
| | | |
| | | /** |
| | | 被复制对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectKey; |
| | | |
| | | /** |
| | | 被复制对版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 复制后的桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstBucketName; |
| | | |
| | | /** |
| | | 复制后的对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstObjectKey; |
| | | |
| | | /** |
| | | 复制后对象访问策略 |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy dstObjectACLPolicy; |
| | | |
| | | /** |
| | | 复制后对象元数据 |
| | | */ |
| | | @property (nonatomic, assign) OBSMetaDirective dstObjectMetaDirective; |
| | | |
| | | /** |
| | | 如果etag匹配则复制 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *cpSrcIfETagMatch; |
| | | |
| | | /** |
| | | 如果etag不匹配则复制 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *cpSrcIfETagNoneMatch; |
| | | |
| | | /** |
| | | 只有当源对象在此参数指定的时间之后修改过才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *cpSrcIfModifiedSince; |
| | | |
| | | /** |
| | | 只有当源对象不在此参数指定的时间之后修改过才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *cpSrcIfUnmodifiedSince; |
| | | |
| | | /** |
| | | 复制后对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass dstObjectStorageClass; |
| | | |
| | | /** |
| | | 复制后对象网站重定向 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstObjectWebsiteRedirectLocation; |
| | | |
| | | /** |
| | | 复制后对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *dstObjectEncryption; |
| | | |
| | | /** |
| | | 被复制对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *srcObjectEncryption; |
| | | |
| | | /** |
| | | 自定义元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 复制对象request |
| | | */ |
| | | @interface OBSCopyObjectRequest: OBSBaseRequest<OBSCopyObjectProtocol> |
| | | |
| | | /** |
| | | 被复制桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcBucketName; |
| | | |
| | | /** |
| | | 被复制的对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectKey; |
| | | |
| | | /** |
| | | 被复制对象多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 复制后的桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstBucketName; |
| | | |
| | | /** |
| | | 复制后的对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstObjectKey; |
| | | |
| | | |
| | | /** |
| | | 复制后对象的ACL |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy dstObjectACLPolicy; |
| | | |
| | | /** |
| | | 复制后对象的元数据 |
| | | */ |
| | | @property (nonatomic, assign) OBSMetaDirective dstObjectMetaDirective; |
| | | |
| | | |
| | | /** |
| | | 只有当源对象的Etag与此参数指定的值相等时才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *cpSrcIfETagMatch; |
| | | |
| | | /** |
| | | 只有当源对象的Etag与此参数指定的值不相等时才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *cpSrcIfETagNoneMatch; |
| | | |
| | | |
| | | /** |
| | | 只有当源对象在此参数指定的时间之后修改过才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *cpSrcIfModifiedSince; |
| | | |
| | | /** |
| | | 只有当源对象在此参数指定的时间之后没有修改过才进行复制对象操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *cpSrcIfUnmodifiedSince; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass dstObjectStorageClass; |
| | | |
| | | /** |
| | | 对象重定向 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstObjectWebsiteRedirectLocation; |
| | | |
| | | /** |
| | | 复制后的对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *dstObjectEncryption; |
| | | |
| | | /** |
| | | 被复制对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *srcObjectEncryption; |
| | | |
| | | /** |
| | | 自定义元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 自定义MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *customContentType; |
| | | |
| | | /** |
| | | 初始化复制对象request |
| | | |
| | | @param srcBucketName 被复制桶名 |
| | | @param srcObjectKey 被复制对象的key |
| | | @param dstBucketName 复制后的桶名 |
| | | @param dstObjectKey 复制后对象的key |
| | | @return 复制对象request |
| | | */ |
| | | -(instancetype)initWithSrcBucketName:(NSString*) srcBucketName |
| | | srcObjectKey:(NSString*) srcObjectKey |
| | | dstBucketName:(NSString*) dstBucketName |
| | | dstObjectKey:(NSString*) dstObjectKey; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingCopyObjectRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 复制对象response |
| | | */ |
| | | @interface OBSCopyObjectResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 复制后对象etag值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 对象最后修改时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | |
| | | /** |
| | | 如果桶多版本开启,则返回被复制对象的版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 如果桶多版本开启,则返回新对象的版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *dstObjectVersionID; |
| | | |
| | | |
| | | /** |
| | | 新对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(copyObject) |
| | | |
| | | /** |
| | | 复制对象 |
| | | |
| | | @param request 复制对象request |
| | | @param completionHandler 复制对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)copyObject:(__kindof OBSBaseRequest<OBSCopyObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSCopyObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSCopyObjectModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSCopyPartModel_h |
| | | #define OBSCopyPartModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | @class OBSEncryptionTypeCustomer; |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 拷贝段 |
| | | */ |
| | | @protocol OBSCopyPartProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 被复制桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcBucketName; |
| | | |
| | | /** |
| | | 被复制对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectKey; |
| | | |
| | | /** |
| | | 被复制多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 被复制范围 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *range; |
| | | |
| | | |
| | | /** |
| | | 上传段的桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadBucketName; |
| | | |
| | | /** |
| | | 上传段对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadObjectKey; |
| | | |
| | | /** |
| | | 上传段段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *uploadPartNumber; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 被复制对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *srcObjectEncryption; |
| | | |
| | | /** |
| | | 复制后对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *uploadEncryption; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 拷贝段 |
| | | */ |
| | | @interface OBSCopyPartRequest: OBSBaseRequest<OBSCopyPartProtocol> |
| | | |
| | | /** |
| | | 被拷贝桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcBucketName; |
| | | |
| | | /** |
| | | 被拷贝的对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectKey; |
| | | |
| | | /** |
| | | 被拷贝的对象多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 被拷贝的字节范围 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *range; |
| | | |
| | | |
| | | /** |
| | | 拷贝后桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadBucketName; |
| | | |
| | | /** |
| | | 拷贝后对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadObjectKey; |
| | | |
| | | /** |
| | | 被拷贝的段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *uploadPartNumber; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 被拷贝加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *srcObjectEncryption; |
| | | |
| | | /** |
| | | 拷贝后加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *uploadEncryption; |
| | | |
| | | /** |
| | | 初始化拷贝段request |
| | | |
| | | @param srcBucketName 原始桶名 |
| | | @param srcObjectKey 原始对象KEY |
| | | @param uploadBucketName 拷贝后桶名 |
| | | @param uploadObjectKey 拷贝后对象KEY |
| | | @param uploadPartNumber 拷贝段段号 |
| | | @param uploadID 多段上传任务ID |
| | | @return 拷贝段request |
| | | */ |
| | | -(instancetype)initWithSrcBucketName:(NSString*) srcBucketName |
| | | srcObjectKey:(NSString*) srcObjectKey |
| | | uploadBucketName:(NSString*) uploadBucketName |
| | | uploadObjectKey:(NSString*) uploadObjectKey |
| | | uploadPartNumber:(NSNumber*) uploadPartNumber |
| | | uploadID:(NSString*) uploadID; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingCopyPartRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 拷贝段response |
| | | */ |
| | | @interface OBSCopyPartResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 新段的etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 最后修改时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | |
| | | /** |
| | | 被拷贝对象的多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *srcObjectVersionID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(copyPart) |
| | | |
| | | /** |
| | | 拷贝段 |
| | | |
| | | @param request 拷贝段request |
| | | @param completionHandler 拷贝段回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)copyPart:(__kindof OBSBaseRequest<OBSCopyPartProtocol>*)request |
| | | completionHandler:(void (^)(OBSCopyPartResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSCopyPartModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSCreateBucketModel_h |
| | | #define OBSCreateBucketModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | //request |
| | | #pragma mark - request entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | |
| | | |
| | | /** |
| | | 创建桶的 |
| | | */ |
| | | @protocol OBSCreateBucketProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 创建桶request |
| | | */ |
| | | @interface OBSCreateBucketRequest: OBSBaseRequest<OBSCreateBucketProtocol> |
| | | |
| | | /** |
| | | //区域配置 |
| | | */ |
| | | @property (nonatomic, strong, nullable) OBSBucketConfiguration *configuration; |
| | | |
| | | /** |
| | | ACL设置 |
| | | |
| | | OBSACLPolicyNULL0, |
| | | OBSACLPolicyPrivate, |
| | | OBSACLPolicyPublicRead, |
| | | OBSACLPolicyPublicReadWrite, |
| | | OBSACLPolicyAuthenticatedRead, |
| | | OBSACLPolicyBucketOwnerRead, |
| | | OBSACLPolicyBucketOwnerFullControl, |
| | | OBSACLPolicyLogDeliveryWrite, |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy bucketACLPolicy; |
| | | |
| | | /** |
| | | 桶存储类型 |
| | | |
| | | OBSStorageClassNULL0, |
| | | OBSStorageClassStandard, |
| | | OBSStorageClassStandardIA, |
| | | OBSStorageClassGlacier, |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass defaultStorageClass; |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | //**********************自研协议******************************* |
| | | /** |
| | | 授权给指定domain下的所有用户有READ权限。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantRead; |
| | | /** |
| | | 授权给指定domain下的所有用户有WRITE权限。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantWrite; |
| | | /** |
| | | 授权给指定domain下的所有用户有READ_ACP权限。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantReadAcp; |
| | | /** |
| | | 授权给指定domain下的所有用户有WRITE_ACP权限,允许修改桶的ACL信息。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantWriteAcp; |
| | | /** |
| | | 授权给指定domain下的所有用户有FULL_CONTROL权限。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantfullControl; |
| | | /** |
| | | 授权给指定domain下的所有用户有READ权限,并且在默认情况下,该READ权限将传递给桶内所有对象。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantreadDelivered; |
| | | /** |
| | | 授权给指定domain下的所有用户有FULL_CONTROL权限,并且在默认情况下,该FULL_CONTROL权限将传递给桶内所有对象。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *grantfullControlDelivered; |
| | | |
| | | |
| | | /** |
| | | 初始化创建桶的request对象 |
| | | |
| | | @param bucketName 桶名 |
| | | @return request实例 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSCreateBucketRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 创建桶response |
| | | */ |
| | | @interface OBSCreateBucketResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶区域位置 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *location; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(createBucket) |
| | | |
| | | /** |
| | | 创建桶 |
| | | |
| | | @param request 创建桶的request对象 |
| | | @param completionHandler 创建桶的回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)createBucket:(__kindof OBSBaseRequest<OBSCreateBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSCreateBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceBaseModel_h */ |
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import "OBSDDASLLogger.h"
|
| | |
|
| | | @protocol OBSDDLogger;
|
| | |
|
| | | /**
|
| | | * This class provides the ability to capture the ASL (Apple System Logs)
|
| | | */
|
| | | @interface OBSDDASLLogCapture : NSObject
|
| | |
|
| | | /**
|
| | | * Start capturing logs
|
| | | */
|
| | | + (void)start;
|
| | |
|
| | | /**
|
| | | * Stop capturing logs
|
| | | */
|
| | | + (void)stop;
|
| | |
|
| | | /**
|
| | | * The current capture level.
|
| | | * @note Default log level: OBSDDLogLevelVerbose (i.e. capture all ASL messages).
|
| | | */
|
| | | @property (class) OBSDDLogLevel captureLevel;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | // Custom key set on messages sent to ASL
|
| | | extern const char *const kOBSDDASLKeyOBSDDLog;
|
| | |
|
| | | // Value set for kOBSDDASLKeyOBSDDLog
|
| | | extern const char *const kOBSDDASLOBSDDLogValue;
|
| | |
|
| | | /**
|
| | | *This class provides a logger for the Apple System Log facility.
|
| | | *
|
| | | *As described in the "Getting Started" page,
|
| | | *the traditional NSLog() function directs its output to two places:
|
| | | *
|
| | | *- Apple System Log
|
| | | *- StdErr (if stderr is a TTY) so log statements show up in Xcode console
|
| | | *
|
| | | *To duplicate NSLog() functionality you can simply add this logger and a tty logger.
|
| | | *However, if you instead choose to use file logging (for faster performance),
|
| | | *you may choose to use a file logger and a tty logger.
|
| | | **/
|
| | | @interface OBSDDASLLogger : OBSDDAbstractLogger <OBSDDLogger>
|
| | |
|
| | | /**
|
| | | * Singleton method
|
| | | *
|
| | | * @return the shared instance
|
| | | */
|
| | | @property (class, readonly, strong) OBSDDASLLogger *sharedInstance;
|
| | |
|
| | | // Inherited from OBSDDAbstractLogger
|
| | |
|
| | | // - (id <OBSDDLogFormatter>)logFormatter;
|
| | | // - (void)setLogFormatter:(id <OBSDDLogFormatter>)formatter;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *This class provides an abstract implementation of a database logger.
|
| | | *
|
| | | *That is, it provides the base implementation for a database logger to build atop of.
|
| | | *All that is needed for a concrete database logger is to extend this class
|
| | | *and override the methods in the implementation file that are prefixed with "db_".
|
| | | **/
|
| | | @interface OBSDDAbstractDatabaseLogger : OBSDDAbstractLogger {
|
| | | |
| | | @protected
|
| | | NSUInteger _saveThreshold;
|
| | | NSTimeInterval _saveInterval;
|
| | | NSTimeInterval _maxAge;
|
| | | NSTimeInterval _deleteInterval;
|
| | | BOOL _deleteOnEverySave;
|
| | | |
| | | BOOL _saveTimerSuspended;
|
| | | NSUInteger _unsavedCount;
|
| | | dispatch_time_t _unsavedTime;
|
| | | dispatch_source_t _saveTimer;
|
| | | dispatch_time_t _lastDeleteTime;
|
| | | dispatch_source_t _deleteTimer;
|
| | | }
|
| | |
|
| | | /**
|
| | | *Specifies how often to save the data to disk.
|
| | | *Since saving is an expensive operation (disk io) it is not done after every log statement.
|
| | | *These properties allow you to configure how/when the logger saves to disk.
|
| | | *
|
| | | *A save is done when either (whichever happens first):
|
| | | *
|
| | | *- The number of unsaved log entries reaches saveThreshold
|
| | | *- The amount of time since the oldest unsaved log entry was created reaches saveInterval
|
| | | *
|
| | | *You can optionally disable the saveThreshold by setting it to zero.
|
| | | *If you disable the saveThreshold you are entirely dependent on the saveInterval.
|
| | | *
|
| | | *You can optionally disable the saveInterval by setting it to zero (or a negative value).
|
| | | *If you disable the saveInterval you are entirely dependent on the saveThreshold.
|
| | | *
|
| | | *It's not wise to disable both saveThreshold and saveInterval.
|
| | | *
|
| | | *The default saveThreshold is 500.
|
| | | *The default saveInterval is 60 seconds.
|
| | | **/
|
| | | @property (assign, readwrite) NSUInteger saveThreshold;
|
| | |
|
| | | /**
|
| | | * See the description for the `saveThreshold` property
|
| | | */
|
| | | @property (assign, readwrite) NSTimeInterval saveInterval;
|
| | |
|
| | | /**
|
| | | *It is likely you don't want the log entries to persist forever.
|
| | | *Doing so would allow the database to grow infinitely large over time.
|
| | | *
|
| | | *The maxAge property provides a way to specify how old a log statement can get
|
| | | *before it should get deleted from the database.
|
| | | *
|
| | | *The deleteInterval specifies how often to sweep for old log entries.
|
| | | *Since deleting is an expensive operation (disk io) is is done on a fixed interval.
|
| | | *
|
| | | *An alternative to the deleteInterval is the deleteOnEverySave option.
|
| | | *This specifies that old log entries should be deleted during every save operation.
|
| | | *
|
| | | *You can optionally disable the maxAge by setting it to zero (or a negative value).
|
| | | *If you disable the maxAge then old log statements are not deleted.
|
| | | *
|
| | | *You can optionally disable the deleteInterval by setting it to zero (or a negative value).
|
| | | *
|
| | | *If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted.
|
| | | *
|
| | | *It's not wise to enable both deleteInterval and deleteOnEverySave.
|
| | | *
|
| | | *The default maxAge is 7 days.
|
| | | *The default deleteInterval is 5 minutes.
|
| | | *The default deleteOnEverySave is NO.
|
| | | **/
|
| | | @property (assign, readwrite) NSTimeInterval maxAge;
|
| | |
|
| | | /**
|
| | | * See the description for the `maxAge` property
|
| | | */
|
| | | @property (assign, readwrite) NSTimeInterval deleteInterval;
|
| | |
|
| | | /**
|
| | | * See the description for the `maxAge` property
|
| | | */
|
| | | @property (assign, readwrite) BOOL deleteOnEverySave;
|
| | |
|
| | | /**
|
| | | *Forces a save of any pending log entries (flushes log entries to disk).
|
| | | **/
|
| | | - (void)savePendingLogEntries;
|
| | |
|
| | | /**
|
| | | *Removes any log entries that are older than maxAge.
|
| | | **/
|
| | | - (void)deleteOldLogEntries;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | /**
|
| | | *NSAsset replacement that will output a log message even when assertions are disabled.
|
| | | **/
|
| | | #define OBSDDAssert(condition, frmt, ...) \
|
| | | if (!(condition)) { \
|
| | | NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \
|
| | | OBSDDLogError(@"%@", description); \
|
| | | NSAssert(NO, description); \
|
| | | }
|
| | | #define OBSDDAssertCondition(condition) OBSDDAssert(condition, @"Condition not satisfied: %s", #condition)
|
| | |
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *This class provides a log formatter that filters log statements from a logging context not on the whitelist.
|
| | | *
|
| | | *A log formatter can be added to any logger to format and/or filter its output.
|
| | | *You can learn more about log formatters here:
|
| | | *Documentation/CustomFormatters.md
|
| | | *
|
| | | *You can learn more about logging context's here:
|
| | | *Documentation/CustomContext.md
|
| | | *
|
| | | *But here's a quick overview / refresher:
|
| | | *
|
| | | *Every log statement has a logging context.
|
| | | *These come from the underlying logging macros defined in OBSDDLog.h.
|
| | | *The default logging context is zero.
|
| | | *You can define multiple logging context's for use in your application.
|
| | | *For example, logically separate parts of your app each have a different logging context.
|
| | | *Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
|
| | | **/
|
| | | @interface OBSDDContextWhitelistFilterLogFormatter : NSObject <OBSDDLogFormatter>
|
| | |
|
| | | /**
|
| | | * Designated default initializer
|
| | | */
|
| | | - (instancetype)init NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | * Add a context to the whitelist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (void)addToWhitelist:(NSUInteger)loggingContext;
|
| | |
|
| | | /**
|
| | | * Remove context from whitelist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (void)removeFromWhitelist:(NSUInteger)loggingContext;
|
| | |
|
| | | /**
|
| | | * Return the whitelist
|
| | | */
|
| | | @property (readonly, copy) NSArray<NSNumber *> *whitelist;
|
| | |
|
| | | /**
|
| | | * Check if a context is on the whitelist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (BOOL)isOnWhitelist:(NSUInteger)loggingContext;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | *This class provides a log formatter that filters log statements from a logging context on the blacklist.
|
| | | **/
|
| | | @interface OBSDDContextBlacklistFilterLogFormatter : NSObject <OBSDDLogFormatter>
|
| | |
|
| | | - (instancetype)init NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | * Add a context to the blacklist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (void)addToBlacklist:(NSUInteger)loggingContext;
|
| | |
|
| | | /**
|
| | | * Remove context from blacklist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (void)removeFromBlacklist:(NSUInteger)loggingContext;
|
| | |
|
| | | /**
|
| | | * Return the blacklist
|
| | | */
|
| | | @property (readonly, copy) NSArray<NSNumber *> *blacklist;
|
| | |
|
| | |
|
| | | /**
|
| | | * Check if a context is on the blacklist
|
| | | *
|
| | | * @param loggingContext the context
|
| | | */
|
| | | - (BOOL)isOnBlacklist:(NSUInteger)loggingContext;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #import <libkern/OSAtomic.h>
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | * Log formatter mode
|
| | | */
|
| | | typedef NS_ENUM(NSUInteger, OBSDDDispatchQueueLogFormatterMode){
|
| | | /**
|
| | | * This is the default option, means the formatter can be reused between multiple loggers and therefore is thread-safe.
|
| | | * There is, of course, a performance cost for the thread-safety
|
| | | */
|
| | | OBSDDDispatchQueueLogFormatterModeShareble = 0,
|
| | | /**
|
| | | * If the formatter will only be used by a single logger, then the thread-safety can be removed
|
| | | * @note: there is an assert checking if the formatter is added to multiple loggers and the mode is non-shareble
|
| | | */
|
| | | OBSDDDispatchQueueLogFormatterModeNonShareble,
|
| | | };
|
| | |
|
| | |
|
| | | /**
|
| | | *This class provides a log formatter that prints the dispatch_queue label instead of the mach_thread_id.
|
| | | *
|
| | | *A log formatter can be added to any logger to format and/or filter its output.
|
| | | *You can learn more about log formatters here:
|
| | | *Documentation/CustomFormatters.md
|
| | | *
|
| | | *A typical `NSLog` (or `OBSDDTTYLogger`) prints detailed info as `[<process_id>:<thread_id>]`.
|
| | | *For example:
|
| | | *
|
| | | *`2011-10-17 20:21:45.435 AppName[19928:5207] Your log message here`
|
| | | *
|
| | | *Where:
|
| | | *`- 19928 = process id`
|
| | | *`- 5207 = thread id (mach_thread_id printed in hex)`
|
| | | *
|
| | | *When using grand central dispatch (GCD), this information is less useful.
|
| | | *This is because a single serial dispatch queue may be run on any thread from an internally managed thread pool.
|
| | | *For example:
|
| | | *
|
| | | *`2011-10-17 20:32:31.111 AppName[19954:4d07] Message from my_serial_dispatch_queue`
|
| | | *`2011-10-17 20:32:31.112 AppName[19954:5207] Message from my_serial_dispatch_queue`
|
| | | *`2011-10-17 20:32:31.113 AppName[19954:2c55] Message from my_serial_dispatch_queue`
|
| | | *
|
| | | *This formatter allows you to replace the standard `[box:info]` with the dispatch_queue name.
|
| | | *For example:
|
| | | *
|
| | | *`2011-10-17 20:32:31.111 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
| | | *`2011-10-17 20:32:31.112 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
| | | *`2011-10-17 20:32:31.113 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
| | | *
|
| | | *If the dispatch_queue doesn't have a set name, then it falls back to the thread name.
|
| | | *If the current thread doesn't have a set name, then it falls back to the mach_thread_id in hex (like normal).
|
| | | *
|
| | | *Note: If manually creating your own background threads (via `NSThread/alloc/init` or `NSThread/detachNeThread`),
|
| | | *you can use `[[NSThread currentThread] setName:(NSString *)]`.
|
| | | **/
|
| | | @interface OBSDDDispatchQueueLogFormatter : NSObject <OBSDDLogFormatter>
|
| | |
|
| | | /**
|
| | | *Standard init method.
|
| | | *Configure using properties as desired.
|
| | | **/
|
| | | - (instancetype)init NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | * Initializer with ability to set the queue mode
|
| | | *
|
| | | * @param mode choose between OBSDDDispatchQueueLogFormatterModeShareble and OBSDDDispatchQueueLogFormatterModeNonShareble, depending if the formatter is shared between several loggers or not
|
| | | */
|
| | | - (instancetype)initWithMode:(OBSDDDispatchQueueLogFormatterMode)mode;
|
| | |
|
| | | /**
|
| | | *The minQueueLength restricts the minimum size of the [detail box].
|
| | | *If the minQueueLength is set to 0, there is no restriction.
|
| | | *
|
| | | *For example, say a dispatch_queue has a label of "diskIO":
|
| | | *
|
| | | *If the minQueueLength is 0: [diskIO]
|
| | | *If the minQueueLength is 4: [diskIO]
|
| | | *If the minQueueLength is 5: [diskIO]
|
| | | *If the minQueueLength is 6: [diskIO]
|
| | | *If the minQueueLength is 7: [diskIO ]
|
| | | *If the minQueueLength is 8: [diskIO ]
|
| | | *
|
| | | *The default minQueueLength is 0 (no minimum, so [detail box] won't be padded).
|
| | | *
|
| | | *If you want every [detail box] to have the exact same width,
|
| | | *set both minQueueLength and maxQueueLength to the same value.
|
| | | **/
|
| | | @property (assign, atomic) NSUInteger minQueueLength;
|
| | |
|
| | | /**
|
| | | *The maxQueueLength restricts the number of characters that will be inside the [detail box].
|
| | | *If the maxQueueLength is 0, there is no restriction.
|
| | | *
|
| | | *For example, say a dispatch_queue has a label of "diskIO":
|
| | | *
|
| | | *If the maxQueueLength is 0: [diskIO]
|
| | | *If the maxQueueLength is 4: [disk]
|
| | | *If the maxQueueLength is 5: [diskI]
|
| | | *If the maxQueueLength is 6: [diskIO]
|
| | | *If the maxQueueLength is 7: [diskIO]
|
| | | *If the maxQueueLength is 8: [diskIO]
|
| | | *
|
| | | *The default maxQueueLength is 0 (no maximum, so [detail box] won't be truncated).
|
| | | *
|
| | | *If you want every [detail box] to have the exact same width,
|
| | | *set both minQueueLength and maxQueueLength to the same value.
|
| | | **/
|
| | | @property (assign, atomic) NSUInteger maxQueueLength;
|
| | |
|
| | | /**
|
| | | *Sometimes queue labels have long names like "com.apple.main-queue",
|
| | | *but you'd prefer something shorter like simply "main".
|
| | | *
|
| | | *This method allows you to set such preferred replacements.
|
| | | *The above example is set by default.
|
| | | *
|
| | | *To remove/undo a previous replacement, invoke this method with nil for the 'shortLabel' parameter.
|
| | | **/
|
| | | - (NSString *)replacementStringForQueueLabel:(NSString *)longLabel;
|
| | |
|
| | | /**
|
| | | * See the `replacementStringForQueueLabel:` description
|
| | | */
|
| | | - (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel;
|
| | |
|
| | | @end
|
| | |
|
| | | /**
|
| | | * Category on `OBSDDDispatchQueueLogFormatter` to make method declarations easier to extend/modify
|
| | | **/
|
| | | @interface OBSDDDispatchQueueLogFormatter (OverridableMethods)
|
| | |
|
| | | /**
|
| | | * Date formatter default configuration
|
| | | */
|
| | | - (void)configureDateFormatter:(NSDateFormatter *)dateFormatter;
|
| | |
|
| | | /**
|
| | | * Formatter method to transfrom from date to string
|
| | | */
|
| | | - (NSString *)stringFromDate:(NSDate *)date;
|
| | |
|
| | | /**
|
| | | * Method to compute the queue thread label
|
| | | */
|
| | | - (NSString *)queueThreadLabelForLogMessage:(OBSDDLogMessage *)logMessage;
|
| | |
|
| | | /**
|
| | | * The actual method that formats a message (transforms a `OBSDDLogMessage` model into a printable string)
|
| | | */
|
| | | - (NSString *)formatLogMessage:(OBSDDLogMessage *)logMessage;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | @class OBSDDLogFileInfo;
|
| | |
|
| | | /**
|
| | | *This class provides a logger to write log statements to a file.
|
| | | **/
|
| | |
|
| | |
|
| | | // Default configuration and safety/sanity values.
|
| | | //
|
| | | // maximumFileSize -> kOBSDDDefaultLogMaxFileSize
|
| | | // rollingFrequency -> kOBSDDDefaultLogRollingFrequency
|
| | | // maximumNumberOfLogFiles -> kOBSDDDefaultLogMaxNumLogFiles
|
| | | // logFilesDiskQuota -> kOBSDDDefaultLogFilesDiskQuota
|
| | | //
|
| | | // You should carefully consider the proper configuration values for your application.
|
| | |
|
| | | extern unsigned long long const kOBSDDDefaultLogMaxFileSize;
|
| | | extern NSTimeInterval const kOBSDDDefaultLogRollingFrequency;
|
| | | extern NSUInteger const kOBSDDDefaultLogMaxNumLogFiles;
|
| | | extern unsigned long long const kOBSDDDefaultLogFilesDiskQuota;
|
| | |
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * The LogFileManager protocol is designed to allow you to control all aspects of your log files.
|
| | | *
|
| | | * The primary purpose of this is to allow you to do something with the log files after they have been rolled.
|
| | | * Perhaps you want to compress them to save disk space.
|
| | | * Perhaps you want to upload them to an FTP server.
|
| | | * Perhaps you want to run some analytics on the file.
|
| | | *
|
| | | * A default LogFileManager is, of course, provided.
|
| | | * The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property.
|
| | | *
|
| | | * This protocol provides various methods to fetch the list of log files.
|
| | | *
|
| | | * There are two variants: sorted and unsorted.
|
| | | * If sorting is not necessary, the unsorted variant is obviously faster.
|
| | | * The sorted variant will return an array sorted by when the log files were created,
|
| | | * with the most recently created log file at index 0, and the oldest log file at the end of the array.
|
| | | *
|
| | | * You can fetch only the log file paths (full path including name), log file names (name only),
|
| | | * or an array of `OBSDDLogFileInfo` objects.
|
| | | * The `OBSDDLogFileInfo` class is documented below, and provides a handy wrapper that
|
| | | * gives you easy access to various file attributes such as the creation date or the file size.
|
| | | */
|
| | | @protocol OBSDDLogFileManager <NSObject>
|
| | | @required
|
| | |
|
| | | // Public properties
|
| | |
|
| | | /**
|
| | | *The maximum number of archived log files to keep on disk.
|
| | | *For example, if this property is set to 3,
|
| | | *then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk.
|
| | | *Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted.
|
| | | *
|
| | | *You may optionally disable this option by setting it to zero.
|
| | | **/
|
| | | @property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
|
| | |
|
| | | /**
|
| | | *The maximum space that logs can take. On rolling logfile all old logfiles that exceed logFilesDiskQuota will
|
| | | *be deleted.
|
| | | *
|
| | | *You may optionally disable this option by setting it to zero.
|
| | | **/
|
| | | @property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota;
|
| | |
|
| | | // Public methods
|
| | |
|
| | | /**
|
| | | * Returns the logs directory (path)
|
| | | */
|
| | | @property (nonatomic, readonly, copy) NSString *logsDirectory;
|
| | |
|
| | | /**
|
| | | *Returns an array of `NSString` objects,
|
| | | *each of which is the filePath to an existing log file on disk.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFilePaths;
|
| | |
|
| | | /**
|
| | | *Returns an array of `NSString` objects,
|
| | | *each of which is the fileName of an existing log file on disk.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFileNames;
|
| | |
|
| | | /**
|
| | | *Returns an array of `OBSDDLogFileInfo` objects,
|
| | | *each representing an existing log file on disk,
|
| | | *and containing important information about the log file such as it's modification date and size.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<OBSDDLogFileInfo *> *unsortedLogFileInfos;
|
| | |
|
| | | /**
|
| | | *Just like the `unsortedLogFilePaths` method, but sorts the array.
|
| | | *The items in the array are sorted by creation date.
|
| | | *The first item in the array will be the most recently created log file.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFilePaths;
|
| | |
|
| | | /**
|
| | | *Just like the `unsortedLogFileNames` method, but sorts the array.
|
| | | *The items in the array are sorted by creation date.
|
| | | *The first item in the array will be the most recently created log file.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFileNames;
|
| | |
|
| | | /**
|
| | | *Just like the `unsortedLogFileInfos` method, but sorts the array.
|
| | | *The items in the array are sorted by creation date.
|
| | | *The first item in the array will be the most recently created log file.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) NSArray<OBSDDLogFileInfo *> *sortedLogFileInfos;
|
| | |
|
| | | // Private methods (only to be used by OBSDDFileLogger)
|
| | |
|
| | | /**
|
| | | *Generates a new unique log file path, and creates the corresponding log file.
|
| | | **/
|
| | | - (NSString *)createNewLogFile;
|
| | |
|
| | | @optional
|
| | |
|
| | | // Notifications from OBSDDFileLogger
|
| | |
|
| | | /**
|
| | | * Called when a log file was archieved
|
| | | */
|
| | | - (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:));
|
| | |
|
| | | /**
|
| | | * Called when the roll action was executed and the log was archieved
|
| | | */
|
| | | - (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:));
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | *Default log file manager.
|
| | | *
|
| | | *All log files are placed inside the logsDirectory.
|
| | | *If a specific logsDirectory isn't specified, the default directory is used.
|
| | | *On Mac, this is in `~/Library/Logs/<Application Name>`.
|
| | | *On iPhone, this is in `~/Library/Caches/Logs`.
|
| | | *
|
| | | *Log files are named `"<bundle identifier> <date> <time>.log"`
|
| | | *Example: `com.organization.myapp 2013-12-03 17-14.log`
|
| | | *
|
| | | *Archived log files are automatically deleted according to the `maximumNumberOfLogFiles` property.
|
| | | **/
|
| | | @interface OBSDDLogFileManagerDefault : NSObject <OBSDDLogFileManager>
|
| | |
|
| | | /**
|
| | | * Default initializer
|
| | | */
|
| | | - (instancetype)init;
|
| | |
|
| | | /**
|
| | | * Designated initialized, requires the logs directory
|
| | | */
|
| | | - (instancetype)initWithLogsDirectory:(NSString *)logsDirectory NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | #if TARGET_OS_IPHONE
|
| | | /*
|
| | | *Calling this constructor you can override the default "automagically" chosen NSFileProtection level.
|
| | | *Useful if you are writing a command line utility / CydiaSubstrate addon for iOS that has no NSBundle
|
| | | *or like SpringBoard no BackgroundModes key in the NSBundle:
|
| | | * iPhone:~ root# cycript -p SpringBoard
|
| | | * cy# [NSBundle mainBundle]
|
| | | * #"NSBundle </System/Library/CoreServices/SpringBoard.app> (loaded)"
|
| | | * cy# [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
|
| | | * null
|
| | | * cy#
|
| | | **/
|
| | | - (instancetype)initWithLogsDirectory:(NSString *)logsDirectory defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel;
|
| | | #endif
|
| | |
|
| | | /*
|
| | | *Methods to override.
|
| | | *
|
| | | *Log files are named `"<bundle identifier> <date> <time>.log"`
|
| | | *Example: `com.organization.myapp 2013-12-03 17-14.log`
|
| | | *
|
| | | *If you wish to change default filename, you can override following two methods.
|
| | | *- `newLogFileName` method would be called on new logfile creation.
|
| | | *- `isLogFile:` method would be called to filter logfiles from all other files in logsDirectory.
|
| | | * You have to parse given filename and return YES if it is logFile.
|
| | | *
|
| | | ***NOTE**
|
| | | *`newLogFileName` returns filename. If appropriate file already exists, number would be added
|
| | | *to filename before extension. You have to handle this case in isLogFile: method.
|
| | | *
|
| | | *Example:
|
| | | *- newLogFileName returns `"com.organization.myapp 2013-12-03.log"`,
|
| | | * file `"com.organization.myapp 2013-12-03.log"` would be created.
|
| | | *- after some time `"com.organization.myapp 2013-12-03.log"` is archived
|
| | | *- newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
|
| | | * file `"com.organization.myapp 2013-12-03 2.log"` would be created.
|
| | | *- after some time `"com.organization.myapp 2013-12-03 1.log"` is archived
|
| | | *- newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
|
| | | * file `"com.organization.myapp 2013-12-03 3.log"` would be created.
|
| | | **/
|
| | |
|
| | | /**
|
| | | *Generates log file name with default format `"<bundle identifier> <date> <time>.log"`
|
| | | *Example: `MobileSafari 2013-12-03 17-14.log`
|
| | | *
|
| | | *You can change it by overriding `newLogFileName` and `isLogFile:` methods.
|
| | | **/
|
| | | @property (readonly, copy) NSString *newLogFileName;
|
| | |
|
| | | /**
|
| | | *Default log file name is `"<bundle identifier> <date> <time>.log"`.
|
| | | *Example: `MobileSafari 2013-12-03 17-14.log`
|
| | | *
|
| | | *You can change it by overriding `newLogFileName` and `isLogFile:` methods.
|
| | | **/
|
| | | - (BOOL)isLogFile:(NSString *)fileName NS_SWIFT_NAME(isLogFile(withName:));
|
| | |
|
| | | /* Inherited from OBSDDLogFileManager protocol:
|
| | |
|
| | | @property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
|
| | | @property (readwrite, assign, atomic) NSUInteger logFilesDiskQuota;
|
| | |
|
| | | - (NSString *)logsDirectory;
|
| | |
|
| | | - (NSArray *)unsortedLogFilePaths;
|
| | | - (NSArray *)unsortedLogFileNames;
|
| | | - (NSArray *)unsortedLogFileInfos;
|
| | |
|
| | | - (NSArray *)sortedLogFilePaths;
|
| | | - (NSArray *)sortedLogFileNames;
|
| | | - (NSArray *)sortedLogFileInfos;
|
| | |
|
| | | */
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | *Most users will want file log messages to be prepended with the date and time.
|
| | | *Rather than forcing the majority of users to write their own formatter,
|
| | | *we will supply a logical default formatter.
|
| | | *Users can easily replace this formatter with their own by invoking the `setLogFormatter:` method.
|
| | | *It can also be removed by calling `setLogFormatter:`, and passing a nil parameter.
|
| | | *
|
| | | *In addition to the convenience of having a logical default formatter,
|
| | | *it will also provide a template that makes it easy for developers to copy and change.
|
| | | **/
|
| | | @interface OBSDDLogFileFormatterDefault : NSObject <OBSDDLogFormatter>
|
| | |
|
| | | /**
|
| | | * Default initializer
|
| | | */
|
| | | - (instancetype)init;
|
| | |
|
| | | /**
|
| | | * Designated initializer, requires a date formatter
|
| | | */
|
| | | - (instancetype)initWithDateFormatter:(NSDateFormatter *)dateFormatter NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * The standard implementation for a file logger
|
| | | */
|
| | | @interface OBSDDFileLogger : OBSDDAbstractLogger <OBSDDLogger> {
|
| | | OBSDDLogFileInfo *_currentLogFileInfo;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Default initializer
|
| | | */
|
| | | - (instancetype)init;
|
| | |
|
| | | /**
|
| | | * Designated initializer, requires a `OBSDDLogFileManager` instance
|
| | | */
|
| | | - (instancetype)initWithLogFileManager:(id <OBSDDLogFileManager>)logFileManager NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | * Called when the logger is about to write message. Call super before your implementation.
|
| | | */
|
| | | - (void)willLogMessage NS_REQUIRES_SUPER;
|
| | |
|
| | | /**
|
| | | * Called when the logger wrote message. Call super after your implementation.
|
| | | */
|
| | | - (void)didLogMessage NS_REQUIRES_SUPER;
|
| | |
|
| | | /**
|
| | | * Called when the logger checks archive or not current log file.
|
| | | * Override this method to exdend standart behavior. By default returns NO.
|
| | | */
|
| | | - (BOOL)shouldArchiveRecentLogFileInfo:(OBSDDLogFileInfo *)recentLogFileInfo;
|
| | |
|
| | | /**
|
| | | *Log File Rolling:
|
| | | *
|
| | | *`maximumFileSize`:
|
| | | * The approximate maximum size (in bytes) to allow log files to grow.
|
| | | * If a log file is larger than this value after a log statement is appended,
|
| | | * then the log file is rolled.
|
| | | *
|
| | | *`rollingFrequency`
|
| | | * How often to roll the log file.
|
| | | * The frequency is given as an `NSTimeInterval`, which is a double that specifies the interval in seconds.
|
| | | * Once the log file gets to be this old, it is rolled.
|
| | | *
|
| | | *`doNotReuseLogFiles`
|
| | | * When set, will always create a new log file at application launch.
|
| | | *
|
| | | *Both the `maximumFileSize` and the `rollingFrequency` are used to manage rolling.
|
| | | *Whichever occurs first will cause the log file to be rolled.
|
| | | *
|
| | | *For example:
|
| | | *The `rollingFrequency` is 24 hours,
|
| | | *but the log file surpasses the `maximumFileSize` after only 20 hours.
|
| | | *The log file will be rolled at that 20 hour mark.
|
| | | *A new log file will be created, and the 24 hour timer will be restarted.
|
| | | *
|
| | | *You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero.
|
| | | *If you do so, rolling is based solely on `rollingFrequency`.
|
| | | *
|
| | | *You may optionally disable rolling due to time by setting `rollingFrequency` to zero (or any non-positive number).
|
| | | *If you do so, rolling is based solely on `maximumFileSize`.
|
| | | *
|
| | | *If you disable both `maximumFileSize` and `rollingFrequency`, then the log file won't ever be rolled.
|
| | | *This is strongly discouraged.
|
| | | **/
|
| | | @property (readwrite, assign) unsigned long long maximumFileSize;
|
| | |
|
| | | /**
|
| | | * See description for `maximumFileSize`
|
| | | */
|
| | | @property (readwrite, assign) NSTimeInterval rollingFrequency;
|
| | |
|
| | | /**
|
| | | * See description for `maximumFileSize`
|
| | | */
|
| | | @property (readwrite, assign, atomic) BOOL doNotReuseLogFiles;
|
| | |
|
| | | /**
|
| | | *The OBSDDLogFileManager instance can be used to retrieve the list of log files,
|
| | | *and configure the maximum number of archived log files to keep.
|
| | | *
|
| | | *@see OBSDDLogFileManager.maximumNumberOfLogFiles
|
| | | **/
|
| | | @property (strong, nonatomic, readonly) id <OBSDDLogFileManager> logFileManager;
|
| | |
|
| | | /**
|
| | | *When using a custom formatter you can set the `logMessage` method not to append
|
| | | *`\n` character after each output. This allows for some greater flexibility with
|
| | | *custom formatters. Default value is YES.
|
| | | **/
|
| | | @property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters;
|
| | |
|
| | | /**
|
| | | * You can optionally force the current log file to be rolled with this method.
|
| | | * CompletionBlock will be called on main queue.
|
| | | */
|
| | | - (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock NS_SWIFT_NAME(rollLogFile(withCompletion:));
|
| | |
|
| | | /**
|
| | | * Method is deprecated.
|
| | | * @deprecated Use `rollLogFileWithCompletionBlock:` method instead.
|
| | | */
|
| | | - (void)rollLogFile __attribute((deprecated));
|
| | |
|
| | | // Inherited from OBSDDAbstractLogger
|
| | |
|
| | | // - (id <OBSDDLogFormatter>)logFormatter;
|
| | | // - (void)setLogFormatter:(id <OBSDDLogFormatter>)formatter;
|
| | |
|
| | | /**
|
| | | *Returns the log file that should be used.
|
| | | *If there is an existing log file that is suitable,
|
| | | *within the constraints of `maximumFileSize` and `rollingFrequency`, then it is returned.
|
| | | *
|
| | | *Otherwise a new file is created and returned.
|
| | | **/
|
| | | @property (nonatomic, readonly, strong) OBSDDLogFileInfo *currentLogFileInfo;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | *`OBSDDLogFileInfo` is a simple class that provides access to various file attributes.
|
| | | *It provides good performance as it only fetches the information if requested,
|
| | | *and it caches the information to prevent duplicate fetches.
|
| | | *
|
| | | *It was designed to provide quick snapshots of the current state of log files,
|
| | | *and to help sort log files in an array.
|
| | | *
|
| | | *This class does not monitor the files, or update it's cached attribute values if the file changes on disk.
|
| | | *This is not what the class was designed for.
|
| | | *
|
| | | *If you absolutely must get updated values,
|
| | | *you can invoke the reset method which will clear the cache.
|
| | | **/
|
| | | @interface OBSDDLogFileInfo : NSObject
|
| | |
|
| | | @property (strong, nonatomic, readonly) NSString *filePath;
|
| | | @property (strong, nonatomic, readonly) NSString *fileName;
|
| | |
|
| | | #if FOUNDATION_SWIFT_SDK_EPOCH_AT_LEAST(8)
|
| | | @property (strong, nonatomic, readonly) NSDictionary<NSFileAttributeKey, id> *fileAttributes;
|
| | | #else
|
| | | @property (strong, nonatomic, readonly) NSDictionary<NSString *, id> *fileAttributes;
|
| | | #endif
|
| | |
|
| | | @property (strong, nonatomic, readonly) NSDate *creationDate;
|
| | | @property (strong, nonatomic, readonly) NSDate *modificationDate;
|
| | |
|
| | | @property (nonatomic, readonly) unsigned long long fileSize;
|
| | |
|
| | | @property (nonatomic, readonly) NSTimeInterval age;
|
| | |
|
| | | @property (nonatomic, readwrite) BOOL isArchived;
|
| | |
|
| | | + (instancetype)logFileWithPath:(NSString *)filePath NS_SWIFT_UNAVAILABLE("Use init(filePath:)");
|
| | |
|
| | | - (instancetype)init NS_UNAVAILABLE;
|
| | | - (instancetype)initWithFilePath:(NSString *)filePath NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | - (void)reset;
|
| | | - (void)renameFile:(NSString *)newFileName NS_SWIFT_NAME(renameFile(to:));
|
| | |
|
| | | #if TARGET_IPHONE_SIMULATOR
|
| | |
|
| | | // So here's the situation.
|
| | | // Extended attributes are perfect for what we're trying to do here (marking files as archived).
|
| | | // This is exactly what extended attributes were designed for.
|
| | | //
|
| | | // But Apple screws us over on the simulator.
|
| | | // Everytime you build-and-go, they copy the application into a new folder on the hard drive,
|
| | | // and as part of the process they strip extended attributes from our log files.
|
| | | // Normally, a copy of a file preserves extended attributes.
|
| | | // So obviously Apple has gone to great lengths to piss us off.
|
| | | //
|
| | | // Thus we use a slightly different tactic for marking log files as archived in the simulator.
|
| | | // That way it "just works" and there's no confusion when testing.
|
| | | //
|
| | | // The difference in method names is indicative of the difference in functionality.
|
| | | // On the simulator we add an attribute by appending a filename extension.
|
| | | //
|
| | | // For example:
|
| | | // "mylog.txt" -> "mylog.archived.txt"
|
| | | // "mylog" -> "mylog.archived"
|
| | |
|
| | | - (BOOL)hasExtensionAttributeWithName:(NSString *)attrName;
|
| | |
|
| | | - (void)addExtensionAttributeWithName:(NSString *)attrName;
|
| | | - (void)removeExtensionAttributeWithName:(NSString *)attrName;
|
| | |
|
| | | #else /* if TARGET_IPHONE_SIMULATOR */
|
| | |
|
| | | // Normal use of extended attributes used everywhere else,
|
| | | // such as on Macs and on iPhone devices.
|
| | |
|
| | | - (BOOL)hasExtendedAttributeWithName:(NSString *)attrName;
|
| | |
|
| | | - (void)addExtendedAttributeWithName:(NSString *)attrName;
|
| | | - (void)removeExtendedAttributeWithName:(NSString *)attrName;
|
| | |
|
| | | #endif /* if TARGET_IPHONE_SIMULATOR */
|
| | |
|
| | | - (NSComparisonResult)reverseCompareByCreationDate:(OBSDDLogFileInfo *)another;
|
| | | - (NSComparisonResult)reverseCompareByModificationDate:(OBSDDLogFileInfo *)another;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | /**
|
| | | *Legacy macros used for 1.9.x backwards compatibility.
|
| | | *
|
| | | *Imported by default when importing a OBSDDLog.h directly and OBSDD_LEGACY_MACROS is not defined and set to 0.
|
| | | **/
|
| | | #if OBSDD_LEGACY_MACROS
|
| | |
|
| | | #warning CocoaLumberjack 1.9.x legacy macros enabled. \
|
| | | Disable legacy macros by importing CocoaLumberjack.h or OBSDDLogMacros.h instead of OBSDDLog.h or add `#define OBSDD_LEGACY_MACROS 0` before importing OBSDDLog.h.
|
| | |
|
| | | #ifndef OBSLOG_LEVEL_DEF
|
| | | #define OBSLOG_LEVEL_DEF obsddLogLevel
|
| | | #endif
|
| | |
|
| | | #define OBSLOG_FLAG_ERROR OBSDDLogFlagError
|
| | | #define OBSLOG_FLAG_WARN OBSDDLogFlagWarning
|
| | | #define OBSLOG_FLAG_INFO OBSDDLogFlagInfo
|
| | | #define OBSLOG_FLAG_DEBUG OBSDDLogFlagDebug
|
| | | #define OBSLOG_FLAG_VERBOSE OBSDDLogFlagVerbose
|
| | |
|
| | | #define OBSLOG_LEVEL_OFF OBSDDLogLevelOff
|
| | | #define OBSLOG_LEVEL_ERROR OBSDDLogLevelError
|
| | | #define OBSLOG_LEVEL_WARN OBSDDLogLevelWarning
|
| | | #define OBSLOG_LEVEL_INFO OBSDDLogLevelInfo
|
| | | #define OBSLOG_LEVEL_DEBUG OBSDDLogLevelDebug
|
| | | #define OBSLOG_LEVEL_VERBOSE OBSDDLogLevelVerbose
|
| | | #define OBSLOG_LEVEL_ALL OBSDDLogLevelAll
|
| | |
|
| | | #define OBSLOG_ASYNC_ENABLED YES
|
| | |
|
| | | #define OBSLOG_ASYNC_ERROR ( NO && OBSLOG_ASYNC_ENABLED)
|
| | | #define OBSLOG_ASYNC_WARN (YES && OBSLOG_ASYNC_ENABLED)
|
| | | #define OBSLOG_ASYNC_INFO (YES && OBSLOG_ASYNC_ENABLED)
|
| | | #define OBSLOG_ASYNC_DEBUG (YES && OBSLOG_ASYNC_ENABLED)
|
| | | #define OBSLOG_ASYNC_VERBOSE (YES && OBSLOG_ASYNC_ENABLED)
|
| | |
|
| | | #define OBSLOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
| | | [OBSDDLog log : isAsynchronous \
|
| | | level : lvl \
|
| | | flag : flg \
|
| | | context : ctx \
|
| | | file : __FILE__ \
|
| | | function : fnct \
|
| | | line : __LINE__ \
|
| | | tag : atag \
|
| | | format : (frmt), ## __VA_ARGS__]
|
| | |
|
| | | #define OBSLOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \
|
| | | do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0)
|
| | |
|
| | | #define OBSLOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \
|
| | | OBSLOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__)
|
| | |
|
| | | #define OBSDDLogError(frmt, ...) OBSLOG_OBJC_MAYBE(OBSLOG_ASYNC_ERROR, OBSLOG_LEVEL_DEF, OBSLOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogWarn(frmt, ...) OBSLOG_OBJC_MAYBE(OBSLOG_ASYNC_WARN, OBSLOG_LEVEL_DEF, OBSLOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogInfo(frmt, ...) OBSLOG_OBJC_MAYBE(OBSLOG_ASYNC_INFO, OBSLOG_LEVEL_DEF, OBSLOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogDebug(frmt, ...) OBSLOG_OBJC_MAYBE(OBSLOG_ASYNC_DEBUG, OBSLOG_LEVEL_DEF, OBSLOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogVerbose(frmt, ...) OBSLOG_OBJC_MAYBE(OBSLOG_ASYNC_VERBOSE, OBSLOG_LEVEL_DEF, OBSLOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
|
| | |
|
| | | #endif
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *The constant/variable/method responsible for controlling the current log level.
|
| | | **/
|
| | | #ifndef OBSLOG_LEVEL_DEF
|
| | | #define OBSLOG_LEVEL_DEF obsddLogLevel
|
| | | #endif
|
| | |
|
| | | /**
|
| | | *Whether async should be used by log messages, excluding error messages that are always sent sync.
|
| | | **/
|
| | | #ifndef OBSLOG_ASYNC_ENABLED
|
| | | #define OBSLOG_ASYNC_ENABLED YES
|
| | | #endif
|
| | |
|
| | | /**
|
| | | *This is the single macro that all other macros below compile into.
|
| | | *This big multiline macro makes all the other macros easier to read.
|
| | | **/
|
| | | #define OBSLOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \
|
| | | [OBSDDLog log : isAsynchronous \
|
| | | level : lvl \
|
| | | flag : flg \
|
| | | context : ctx \
|
| | | file : __FILE__ \
|
| | | function : fnct \
|
| | | line : __LINE__ \
|
| | | tag : atag \
|
| | | format : frmt \
|
| | | args : avalist]
|
| | |
|
| | | /**
|
| | | *Define version of the macro that only execute if the log level is above the threshold.
|
| | | *The compiled versions essentially look like this:
|
| | | *
|
| | | *if (logFlagForThisLogMsg & obsddLogLevel) { execute log message }
|
| | | *
|
| | | *When OBSLOG_LEVEL_DEF is defined as obsddLogLevel.
|
| | | *
|
| | | *As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels.
|
| | | *This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques.
|
| | | *
|
| | | *Note that when compiler optimizations are enabled (as they are for your release builds),
|
| | | *the log messages above your logging threshold will automatically be compiled out.
|
| | | *
|
| | | *(If the compiler sees OBSLOG_LEVEL_DEF/obsddLogLevel declared as a constant, the compiler simply checks to see
|
| | | * if the 'if' statement would execute, and if not it strips it from the binary.)
|
| | | *
|
| | | *We also define shorthand versions for asynchronous and synchronous logging.
|
| | | **/
|
| | | #define OBSLOGV_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \
|
| | | do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0)
|
| | |
|
| | | /**
|
| | | *Ready to use log macros with no context or tag.
|
| | | **/
|
| | | #define OBSDDLogVError(frmt, avalist) OBSLOGV_MAYBE(NO, OBSLOG_LEVEL_DEF, OBSDDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
| | | #define OBSDDLogVWarn(frmt, avalist) OBSLOGV_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
| | | #define OBSDDLogVInfo(frmt, avalist) OBSLOGV_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
| | | #define OBSDDLogVDebug(frmt, avalist) OBSLOGV_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
| | | #define OBSDDLogVVerbose(frmt, avalist) OBSLOGV_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
| | |
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | // Enable 1.9.x legacy macros if imported directly
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 1
|
| | | #endif
|
| | | // OBSDD_LEGACY_MACROS is checked in the file itself
|
| | | #import "OBSDDLegacyMacros.h"
|
| | |
|
| | | #if OS_OBJECT_USE_OBJC
|
| | | #define DISPATCH_QUEUE_REFERENCE_TYPE strong
|
| | | #else
|
| | | #define DISPATCH_QUEUE_REFERENCE_TYPE assign
|
| | | #endif
|
| | |
|
| | | @class OBSDDLogMessage;
|
| | | @class OBSDDLoggerInformation;
|
| | | @protocol OBSDDLogger;
|
| | | @protocol OBSDDLogFormatter;
|
| | |
|
| | | /**
|
| | | *Define the standard options.
|
| | | *
|
| | | *We default to only 4 levels because it makes it easier for beginners
|
| | | *to make the transition to a logging framework.
|
| | | *
|
| | | *More advanced users may choose to completely customize the levels (and level names) to suite their needs.
|
| | | *For more information on this see the "Custom Log Levels" page:
|
| | | *Documentation/CustomLogLevels.md
|
| | | *
|
| | | *Advanced users may also notice that we're using a bitmask.
|
| | | *This is to allow for custom fine grained logging:
|
| | | *Documentation/FineGrainedLogging.md
|
| | | *
|
| | | *-- Flags --
|
| | | *
|
| | | *Typically you will use the OBSLOG_LEVELS (see below), but the flags may be used directly in certain situations.
|
| | | *For example, say you have a lot of warning log messages, and you wanted to disable them.
|
| | | *However, you still needed to see your error and info log messages.
|
| | | *You could accomplish that with the following:
|
| | | *
|
| | | *static const OBSDDLogLevel obsddLogLevel = OBSDDLogFlagError | OBSDDLogFlagInfo;
|
| | | *
|
| | | *When OBSLOG_LEVEL_DEF is defined as obsddLogLevel.
|
| | | *
|
| | | *Flags may also be consulted when writing custom log formatters,
|
| | | *as the OBSDDLogMessage class captures the individual flag that caused the log message to fire.
|
| | | *
|
| | | *-- Levels --
|
| | | *
|
| | | *Log levels are simply the proper bitmask of the flags.
|
| | | *
|
| | | *-- Booleans --
|
| | | *
|
| | | *The booleans may be used when your logging code involves more than one line.
|
| | | *For example:
|
| | | *
|
| | | *if (OBSLOG_VERBOSE) {
|
| | | * for (id sprocket in sprockets)
|
| | | * OBSDDLogVerbose(@"sprocket: %@", [sprocket description])
|
| | | *}
|
| | | *
|
| | | *-- Async --
|
| | | *
|
| | | *Defines the default asynchronous options.
|
| | | *The default philosophy for asynchronous logging is very simple:
|
| | | *
|
| | | *Log messages with errors should be executed synchronously.
|
| | | * After all, an error just occurred. The application could be unstable.
|
| | | *
|
| | | *All other log messages, such as debug output, are executed asynchronously.
|
| | | * After all, if it wasn't an error, then it was just informational output,
|
| | | * or something the application was easily able to recover from.
|
| | | *
|
| | | *-- Changes --
|
| | | *
|
| | | *You are strongly discouraged from modifying this file.
|
| | | *If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project.
|
| | | *Instead, create your own MyLogging.h or ApplicationNameLogging.h or CompanyLogging.h
|
| | | *
|
| | | *For an example of customizing your logging experience, see the "Custom Log Levels" page:
|
| | | *Documentation/CustomLogLevels.md
|
| | | **/
|
| | |
|
| | | /**
|
| | | * Flags accompany each log. They are used together with levels to filter out logs.
|
| | | */
|
| | | typedef NS_OPTIONS(NSUInteger, OBSDDLogFlag){
|
| | | /**
|
| | | * 0...00001 OBSDDLogFlagError
|
| | | */
|
| | | OBSDDLogFlagError = (1 << 0),
|
| | | |
| | | /**
|
| | | * 0...00010 OBSDDLogFlagWarning
|
| | | */
|
| | | OBSDDLogFlagWarning = (1 << 1),
|
| | | |
| | | /**
|
| | | * 0...00100 OBSDDLogFlagInfo
|
| | | */
|
| | | OBSDDLogFlagInfo = (1 << 2),
|
| | | |
| | | /**
|
| | | * 0...01000 OBSDDLogFlagDebug
|
| | | */
|
| | | OBSDDLogFlagDebug = (1 << 3),
|
| | | |
| | | /**
|
| | | * 0...10000 OBSDDLogFlagVerbose
|
| | | */
|
| | | OBSDDLogFlagVerbose = (1 << 4)
|
| | | };
|
| | |
|
| | | /**
|
| | | * Log levels are used to filter out logs. Used together with flags.
|
| | | */
|
| | | typedef NS_ENUM(NSUInteger, OBSDDLogLevel){
|
| | | /**
|
| | | * No logs
|
| | | */
|
| | | OBSDDLogLevelOff = 0,
|
| | | |
| | | /**
|
| | | * Error logs only
|
| | | */
|
| | | OBSDDLogLevelError = (OBSDDLogFlagError),
|
| | | |
| | | /**
|
| | | * Error and warning logs
|
| | | */
|
| | | OBSDDLogLevelWarning = (OBSDDLogLevelError | OBSDDLogFlagWarning),
|
| | | |
| | | /**
|
| | | * Error, warning and info logs
|
| | | */
|
| | | OBSDDLogLevelInfo = (OBSDDLogLevelWarning | OBSDDLogFlagInfo),
|
| | | |
| | | /**
|
| | | * Error, warning, info and debug logs
|
| | | */
|
| | | OBSDDLogLevelDebug = (OBSDDLogLevelInfo | OBSDDLogFlagDebug),
|
| | | |
| | | /**
|
| | | * Error, warning, info, debug and verbose logs
|
| | | */
|
| | | OBSDDLogLevelVerbose = (OBSDDLogLevelDebug | OBSDDLogFlagVerbose),
|
| | | |
| | | /**
|
| | | * All logs (1...11111)
|
| | | */
|
| | | OBSDDLogLevelAll = NSUIntegerMax
|
| | | };
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | /**
|
| | | * Extracts just the file name, no path or extension
|
| | | *
|
| | | * @param filePath input file path
|
| | | * @param copy YES if we want the result to be copied
|
| | | *
|
| | | * @return the file name
|
| | | */
|
| | | NSString *__nullable OBSDDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
|
| | |
|
| | | /**
|
| | | *The THIS_FILE macro gives you an NSString of the file name.
|
| | | *For simplicity and clarity, the file name does not include the full path or file extension.
|
| | | *
|
| | | *For example: OBSDDLogWarn(@"%@: Unable to find thingy", THIS_FILE) -> @"MyViewController: Unable to find thingy"
|
| | | **/
|
| | | #define THIS_FILE (OBSDDExtractFileNameWithoutExtension(__FILE__, NO))
|
| | |
|
| | | /**
|
| | | *The THIS_METHOD macro gives you the name of the current objective-c method.
|
| | | *
|
| | | *For example: OBSDDLogWarn(@"%@ - Requires non-nil strings", THIS_METHOD) -> @"setMake:model: requires non-nil strings"
|
| | | *
|
| | | *Note: This does NOT work in straight C functions (non objective-c).
|
| | | *Instead you should use the predefined __FUNCTION__ macro.
|
| | | **/
|
| | | #define THIS_METHOD NSStringFromSelector(_cmd)
|
| | |
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * The main class, exposes all logging mechanisms, loggers, ...
|
| | | * For most of the users, this class is hidden behind the logging functions like `OBSDDLogInfo`
|
| | | */
|
| | | @interface OBSDDLog : NSObject
|
| | |
|
| | | /**
|
| | | * Returns the singleton `OBSDDLog`.
|
| | | * The instance is used by `OBSDDLog` class methods.
|
| | | */
|
| | | @property (class, nonatomic, strong, readonly) OBSDDLog *sharedInstance;
|
| | |
|
| | | /**
|
| | | *Provides access to the underlying logging queue.
|
| | | *This may be helpful to Logger classes for things like thread synchronization.
|
| | | **/
|
| | | @property (class, nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue;
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method is used by the macros or logging functions.
|
| | | *It is suggested you stick with the macros as they're easier to use.
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param level the log level
|
| | | * @param flag the log flag
|
| | | * @param context the context (if any is defined)
|
| | | * @param file the current file
|
| | | * @param function the current function
|
| | | * @param line the current code line
|
| | | * @param tag potential tag
|
| | | * @param format the log format
|
| | | */
|
| | | + (void)log:(BOOL)asynchronous
|
| | | level:(OBSDDLogLevel)level
|
| | | flag:(OBSDDLogFlag)flag
|
| | | context:(NSInteger)context
|
| | | file:(const char *)file
|
| | | function:(const char *)function
|
| | | line:(NSUInteger)line
|
| | | tag:(id __nullable)tag
|
| | | format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method is used by the macros or logging functions.
|
| | | *It is suggested you stick with the macros as they're easier to use.
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param level the log level
|
| | | * @param flag the log flag
|
| | | * @param context the context (if any is defined)
|
| | | * @param file the current file
|
| | | * @param function the current function
|
| | | * @param line the current code line
|
| | | * @param tag potential tag
|
| | | * @param format the log format
|
| | | */
|
| | | - (void)log:(BOOL)asynchronous
|
| | | level:(OBSDDLogLevel)level
|
| | | flag:(OBSDDLogFlag)flag
|
| | | context:(NSInteger)context
|
| | | file:(const char *)file
|
| | | function:(const char *)function
|
| | | line:(NSUInteger)line
|
| | | tag:(id __nullable)tag
|
| | | format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method can be used if you have a prepared va_list.
|
| | | *Similar to `log:level:flag:context:file:function:line:tag:format:...`
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param level the log level
|
| | | * @param flag the log flag
|
| | | * @param context the context (if any is defined)
|
| | | * @param file the current file
|
| | | * @param function the current function
|
| | | * @param line the current code line
|
| | | * @param tag potential tag
|
| | | * @param format the log format
|
| | | * @param argList the arguments list as a va_list
|
| | | */
|
| | | + (void)log:(BOOL)asynchronous
|
| | | level:(OBSDDLogLevel)level
|
| | | flag:(OBSDDLogFlag)flag
|
| | | context:(NSInteger)context
|
| | | file:(const char *)file
|
| | | function:(const char *)function
|
| | | line:(NSUInteger)line
|
| | | tag:(id __nullable)tag
|
| | | format:(NSString *)format
|
| | | args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method can be used if you have a prepared va_list.
|
| | | *Similar to `log:level:flag:context:file:function:line:tag:format:...`
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param level the log level
|
| | | * @param flag the log flag
|
| | | * @param context the context (if any is defined)
|
| | | * @param file the current file
|
| | | * @param function the current function
|
| | | * @param line the current code line
|
| | | * @param tag potential tag
|
| | | * @param format the log format
|
| | | * @param argList the arguments list as a va_list
|
| | | */
|
| | | - (void)log:(BOOL)asynchronous
|
| | | level:(OBSDDLogLevel)level
|
| | | flag:(OBSDDLogFlag)flag
|
| | | context:(NSInteger)context
|
| | | file:(const char *)file
|
| | | function:(const char *)function
|
| | | line:(NSUInteger)line
|
| | | tag:(id __nullable)tag
|
| | | format:(NSString *)format
|
| | | args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method can be used if you manualy prepared OBSDDLogMessage.
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param logMessage the log message stored in a `OBSDDLogMessage` model object
|
| | | */
|
| | | + (void)log:(BOOL)asynchronous
|
| | | message:(OBSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
|
| | |
|
| | | /**
|
| | | *Logging Primitive.
|
| | | *
|
| | | *This method can be used if you manualy prepared OBSDDLogMessage.
|
| | | *
|
| | | * @param asynchronous YES if the logging is done async, NO if you want to force sync
|
| | | * @param logMessage the log message stored in a `OBSDDLogMessage` model object
|
| | | */
|
| | | - (void)log:(BOOL)asynchronous
|
| | | message:(OBSDDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
|
| | |
|
| | | /**
|
| | | *Since logging can be asynchronous, there may be times when you want to flush the logs.
|
| | | *The framework invokes this automatically when the application quits.
|
| | | **/
|
| | | + (void)flushLog;
|
| | |
|
| | | /**
|
| | | *Since logging can be asynchronous, there may be times when you want to flush the logs.
|
| | | *The framework invokes this automatically when the application quits.
|
| | | **/
|
| | | - (void)flushLog;
|
| | |
|
| | | /**
|
| | | *Loggers
|
| | | *
|
| | | *In order for your log statements to go somewhere, you should create and add a logger.
|
| | | *
|
| | | *You can add multiple loggers in order to direct your log statements to multiple places.
|
| | | *And each logger can be configured separately.
|
| | | *So you could have, for example, verbose logging to the console, but a concise log file with only warnings & errors.
|
| | | **/
|
| | |
|
| | | /**
|
| | | *Adds the logger to the system.
|
| | | *
|
| | | *This is equivalent to invoking `[OBSDDLog addLogger:logger withLogLevel:OBSDDLogLevelAll]`.
|
| | | **/
|
| | | + (void)addLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | /**
|
| | | *Adds the logger to the system.
|
| | | *
|
| | | *This is equivalent to invoking `[OBSDDLog addLogger:logger withLogLevel:OBSDDLogLevelAll]`.
|
| | | **/
|
| | | - (void)addLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | /**
|
| | | *Adds the logger to the system.
|
| | | *
|
| | | *The level that you provide here is a preemptive filter (for performance).
|
| | | *That is, the level specified here will be used to filter out logMessages so that
|
| | | *the logger is never even invoked for the messages.
|
| | | *
|
| | | *More information:
|
| | | *When you issue a log statement, the logging framework iterates over each logger,
|
| | | *and checks to see if it should forward the logMessage to the logger.
|
| | | *This check is done using the level parameter passed to this method.
|
| | | *
|
| | | *For example:
|
| | | *
|
| | | *`[OBSDDLog addLogger:consoleLogger withLogLevel:OBSDDLogLevelVerbose];`
|
| | | *`[OBSDDLog addLogger:fileLogger withLogLevel:OBSDDLogLevelWarning];`
|
| | | *
|
| | | *`OBSDDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
|
| | | *`OBSDDLogInfo(@"hi");` => gets forwarded to consoleLogger only
|
| | | *
|
| | | *It is important to remember that Lumberjack uses a BITMASK.
|
| | | *Many developers & third party frameworks may define extra log levels & flags.
|
| | | *For example:
|
| | | *
|
| | | *`#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
|
| | | *
|
| | | *So if you specify `OBSDDLogLevelVerbose` to this method, you won't see the framework's trace messages.
|
| | | *
|
| | | *`(SOME_FRAMEWORK_LOG_FLAG_TRACE & OBSDDLogLevelVerbose) => (01000000 & 00011111) => NO`
|
| | | *
|
| | | *Consider passing `OBSDDLogLevelAll` to this method, which has all bits set.
|
| | | *You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
|
| | | *except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
|
| | | *
|
| | | *`((OBSDDLogLevelAll ^ OBSDDLogLevelVerbose) | OBSDDLogLevelInfo)`
|
| | | **/
|
| | | + (void)addLogger:(id <OBSDDLogger>)logger withLevel:(OBSDDLogLevel)level;
|
| | |
|
| | | /**
|
| | | *Adds the logger to the system.
|
| | | *
|
| | | *The level that you provide here is a preemptive filter (for performance).
|
| | | *That is, the level specified here will be used to filter out logMessages so that
|
| | | *the logger is never even invoked for the messages.
|
| | | *
|
| | | *More information:
|
| | | *When you issue a log statement, the logging framework iterates over each logger,
|
| | | *and checks to see if it should forward the logMessage to the logger.
|
| | | *This check is done using the level parameter passed to this method.
|
| | | *
|
| | | *For example:
|
| | | *
|
| | | *`[OBSDDLog addLogger:consoleLogger withLogLevel:OBSDDLogLevelVerbose];`
|
| | | *`[OBSDDLog addLogger:fileLogger withLogLevel:OBSDDLogLevelWarning];`
|
| | | *
|
| | | *`OBSDDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
|
| | | *`OBSDDLogInfo(@"hi");` => gets forwarded to consoleLogger only
|
| | | *
|
| | | *It is important to remember that Lumberjack uses a BITMASK.
|
| | | *Many developers & third party frameworks may define extra log levels & flags.
|
| | | *For example:
|
| | | *
|
| | | *`#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
|
| | | *
|
| | | *So if you specify `OBSDDLogLevelVerbose` to this method, you won't see the framework's trace messages.
|
| | | *
|
| | | *`(SOME_FRAMEWORK_LOG_FLAG_TRACE & OBSDDLogLevelVerbose) => (01000000 & 00011111) => NO`
|
| | | *
|
| | | *Consider passing `OBSDDLogLevelAll` to this method, which has all bits set.
|
| | | *You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
|
| | | *except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
|
| | | *
|
| | | *`((OBSDDLogLevelAll ^ OBSDDLogLevelVerbose) | OBSDDLogLevelInfo)`
|
| | | **/
|
| | | - (void)addLogger:(id <OBSDDLogger>)logger withLevel:(OBSDDLogLevel)level;
|
| | |
|
| | | /**
|
| | | * Remove the logger from the system
|
| | | */
|
| | | + (void)removeLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | /**
|
| | | * Remove the logger from the system
|
| | | */
|
| | | - (void)removeLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | /**
|
| | | * Remove all the current loggers
|
| | | */
|
| | | + (void)removeAllLoggers;
|
| | |
|
| | | /**
|
| | | * Remove all the current loggers
|
| | | */
|
| | | - (void)removeAllLoggers;
|
| | |
|
| | | /**
|
| | | * Return all the current loggers
|
| | | */
|
| | | @property (class, nonatomic, copy, readonly) NSArray<id<OBSDDLogger>> *allLoggers;
|
| | |
|
| | | /**
|
| | | * Return all the current loggers
|
| | | */
|
| | | @property (nonatomic, copy, readonly) NSArray<id<OBSDDLogger>> *allLoggers;
|
| | |
|
| | | /**
|
| | | * Return all the current loggers with their level (aka OBSDDLoggerInformation).
|
| | | */
|
| | | @property (class, nonatomic, copy, readonly) NSArray<OBSDDLoggerInformation *> *allLoggersWithLevel;
|
| | |
|
| | | /**
|
| | | * Return all the current loggers with their level (aka OBSDDLoggerInformation).
|
| | | */
|
| | | @property (nonatomic, copy, readonly) NSArray<OBSDDLoggerInformation *> *allLoggersWithLevel;
|
| | |
|
| | | /**
|
| | | *Registered Dynamic Logging
|
| | | *
|
| | | *These methods allow you to obtain a list of classes that are using registered dynamic logging,
|
| | | *and also provides methods to get and set their log level during run time.
|
| | | **/
|
| | |
|
| | | /**
|
| | | * Returns an array with the classes that are using registered dynamic logging
|
| | | */
|
| | | @property (class, nonatomic, copy, readonly) NSArray<Class> *registeredClasses;
|
| | |
|
| | | /**
|
| | | * Returns an array with the classes names that are using registered dynamic logging
|
| | | */
|
| | | @property (class, nonatomic, copy, readonly) NSArray<NSString*> *registeredClassNames;
|
| | |
|
| | | /**
|
| | | * Returns the current log level for a certain class
|
| | | *
|
| | | * @param aClass `Class` param
|
| | | */
|
| | | + (OBSDDLogLevel)levelForClass:(Class)aClass;
|
| | |
|
| | | /**
|
| | | * Returns the current log level for a certain class
|
| | | *
|
| | | * @param aClassName string param
|
| | | */
|
| | | + (OBSDDLogLevel)levelForClassWithName:(NSString *)aClassName;
|
| | |
|
| | | /**
|
| | | * Set the log level for a certain class
|
| | | *
|
| | | * @param level the new level
|
| | | * @param aClass `Class` param
|
| | | */
|
| | | + (void)setLevel:(OBSDDLogLevel)level forClass:(Class)aClass;
|
| | |
|
| | | /**
|
| | | * Set the log level for a certain class
|
| | | *
|
| | | * @param level the new level
|
| | | * @param aClassName string param
|
| | | */
|
| | | + (void)setLevel:(OBSDDLogLevel)level forClassWithName:(NSString *)aClassName;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * This protocol describes a basic logger behavior.
|
| | | * Basically, it can log messages, store a logFormatter plus a bunch of optional behaviors.
|
| | | * (i.e. flush, get its loggerQueue, get its name, ...
|
| | | */
|
| | | @protocol OBSDDLogger <NSObject>
|
| | |
|
| | | /**
|
| | | * The log message method
|
| | | *
|
| | | * @param logMessage the message (model)
|
| | | */
|
| | | - (void)logMessage:(OBSDDLogMessage *)logMessage NS_SWIFT_NAME(log(message:));
|
| | |
|
| | | /**
|
| | | *Formatters may optionally be added to any logger.
|
| | | *
|
| | | *If no formatter is set, the logger simply logs the message as it is given in logMessage,
|
| | | *or it may use its own built in formatting style.
|
| | | **/
|
| | | @property (nonatomic, strong) id <OBSDDLogFormatter> logFormatter;
|
| | |
|
| | | @optional
|
| | |
|
| | | /**
|
| | | *Since logging is asynchronous, adding and removing loggers is also asynchronous.
|
| | | *In other words, the loggers are added and removed at appropriate times with regards to log messages.
|
| | | *
|
| | | *- Loggers will not receive log messages that were executed prior to when they were added.
|
| | | *- Loggers will not receive log messages that were executed after they were removed.
|
| | | *
|
| | | *These methods are executed in the logging thread/queue.
|
| | | *This is the same thread/queue that will execute every logMessage: invocation.
|
| | | *Loggers may use these methods for thread synchronization or other setup/teardown tasks.
|
| | | **/
|
| | | - (void)didAddLogger;
|
| | |
|
| | | /**
|
| | | *Since logging is asynchronous, adding and removing loggers is also asynchronous.
|
| | | *In other words, the loggers are added and removed at appropriate times with regards to log messages.
|
| | | *
|
| | | *- Loggers will not receive log messages that were executed prior to when they were added.
|
| | | *- Loggers will not receive log messages that were executed after they were removed.
|
| | | *
|
| | | *These methods are executed in the logging thread/queue given in parameter.
|
| | | *This is the same thread/queue that will execute every logMessage: invocation.
|
| | | *Loggers may use the queue parameter to set specific values on the queue with dispatch_set_specific() function.
|
| | | **/
|
| | | - (void)didAddLoggerInQueue:(dispatch_queue_t)queue;
|
| | |
|
| | | /**
|
| | | * See the above description for `didAddLoger`
|
| | | */
|
| | | - (void)willRemoveLogger;
|
| | |
|
| | | /**
|
| | | *Some loggers may buffer IO for optimization purposes.
|
| | | *For example, a database logger may only save occasionaly as the disk IO is slow.
|
| | | *In such loggers, this method should be implemented to flush any pending IO.
|
| | | *
|
| | | *This allows invocations of OBSDDLog's flushLog method to be propogated to loggers that need it.
|
| | | *
|
| | | *Note that OBSDDLog's flushLog method is invoked automatically when the application quits,
|
| | | *and it may be also invoked manually by the developer prior to application crashes, or other such reasons.
|
| | | **/
|
| | | - (void)flush;
|
| | |
|
| | | /**
|
| | | *Each logger is executed concurrently with respect to the other loggers.
|
| | | *Thus, a dedicated dispatch queue is used for each logger.
|
| | | *Logger implementations may optionally choose to provide their own dispatch queue.
|
| | | **/
|
| | | @property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue;
|
| | |
|
| | | /**
|
| | | *If the logger implementation does not choose to provide its own queue,
|
| | | *one will automatically be created for it.
|
| | | *The created queue will receive its name from this method.
|
| | | *This may be helpful for debugging or profiling reasons.
|
| | | **/
|
| | | @property (nonatomic, readonly) NSString *loggerName;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * This protocol describes the behavior of a log formatter
|
| | | */
|
| | | @protocol OBSDDLogFormatter <NSObject>
|
| | | @required
|
| | |
|
| | | /**
|
| | | *Formatters may optionally be added to any logger.
|
| | | *This allows for increased flexibility in the logging environment.
|
| | | *For example, log messages for log files may be formatted differently than log messages for the console.
|
| | | *
|
| | | *For more information about formatters, see the "Custom Formatters" page:
|
| | | *Documentation/CustomFormatters.md
|
| | | *
|
| | | *The formatter may also optionally filter the log message by returning nil,
|
| | | *in which case the logger will not log the message.
|
| | | **/
|
| | | - (NSString *__nullable)formatLogMessage:(OBSDDLogMessage *)logMessage NS_SWIFT_NAME(format(message:));
|
| | |
|
| | | @optional
|
| | |
|
| | | /**
|
| | | *A single formatter instance can be added to multiple loggers.
|
| | | *These methods provides hooks to notify the formatter of when it's added/removed.
|
| | | *
|
| | | *This is primarily for thread-safety.
|
| | | *If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
|
| | | *Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),
|
| | | *it could possibly use these hooks to switch to thread-safe versions of the code.
|
| | | **/
|
| | | - (void)didAddToLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | /**
|
| | | *A single formatter instance can be added to multiple loggers.
|
| | | *These methods provides hooks to notify the formatter of when it's added/removed.
|
| | | *
|
| | | *This is primarily for thread-safety.
|
| | | *If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
|
| | | *Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter),
|
| | | *it could possibly use these hooks to switch to thread-safe versions of the code or use dispatch_set_specific()
|
| | | . *to add its own specific values.
|
| | | **/
|
| | | - (void)didAddToLogger:(id <OBSDDLogger>)logger inQueue:(dispatch_queue_t)queue;
|
| | |
|
| | | /**
|
| | | * See the above description for `didAddToLogger:`
|
| | | */
|
| | | - (void)willRemoveFromLogger:(id <OBSDDLogger>)logger;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | * This protocol describes a dynamic logging component
|
| | | */
|
| | | @protocol OBSDDRegisteredDynamicLogging
|
| | |
|
| | | /**
|
| | | *Implement these methods to allow a file's log level to be managed from a central location.
|
| | | *
|
| | | *This is useful if you'd like to be able to change log levels for various parts
|
| | | *of your code from within the running application.
|
| | | *
|
| | | *Imagine pulling up the settings for your application,
|
| | | *and being able to configure the logging level on a per file basis.
|
| | | *
|
| | | *The implementation can be very straight-forward:
|
| | | *
|
| | | *```
|
| | | *+ (int)obsddLogLevel
|
| | | *{
|
| | | * return obsddLogLevel;
|
| | | *}
|
| | | *
|
| | | *+ (void)ddSetLogLevel:(OBSDDLogLevel)level
|
| | | *{
|
| | | * obsddLogLevel = level;
|
| | | *}
|
| | | *```
|
| | | **/
|
| | | @property (class, nonatomic, readwrite, setter=ddSetLogLevel:) OBSDDLogLevel obsddLogLevel;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | #ifndef NS_DESIGNATED_INITIALIZER
|
| | | #define NS_DESIGNATED_INITIALIZER
|
| | | #endif
|
| | |
|
| | | /**
|
| | | * Log message options, allow copying certain log elements
|
| | | */
|
| | | typedef NS_OPTIONS(NSInteger, OBSDDLogMessageOptions){
|
| | | /**
|
| | | * Use this to use a copy of the file path
|
| | | */
|
| | | OBSDDLogMessageCopyFile = 1 << 0,
|
| | | /**
|
| | | * Use this to use a copy of the function name
|
| | | */
|
| | | OBSDDLogMessageCopyFunction = 1 << 1,
|
| | | /**
|
| | | * Use this to use avoid a copy of the message
|
| | | */
|
| | | OBSDDLogMessageDontCopyMessage = 1 << 2
|
| | | };
|
| | |
|
| | | /**
|
| | | *The `OBSDDLogMessage` class encapsulates information about the log message.
|
| | | *If you write custom loggers or formatters, you will be dealing with objects of this class.
|
| | | **/
|
| | | @interface OBSDDLogMessage : NSObject <NSCopying>
|
| | | {
|
| | | // Direct accessors to be used only for performance
|
| | | @public
|
| | | NSString *_message;
|
| | | OBSDDLogLevel _level;
|
| | | OBSDDLogFlag _flag;
|
| | | NSInteger _context;
|
| | | NSString *_file;
|
| | | NSString *_fileName;
|
| | | NSString *_function;
|
| | | NSUInteger _line;
|
| | | id _tag;
|
| | | OBSDDLogMessageOptions _options;
|
| | | NSDate *_timestamp;
|
| | | NSString *_threadID;
|
| | | NSString *_threadName;
|
| | | NSString *_queueLabel;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Default `init` for empty messages.
|
| | | */
|
| | | - (instancetype)init NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | *Standard init method for a log message object.
|
| | | *Used by the logging primitives. (And the macros use the logging primitives.)
|
| | | *
|
| | | *If you find need to manually create logMessage objects, there is one thing you should be aware of:
|
| | | *
|
| | | *If no flags are passed, the method expects the file and function parameters to be string literals.
|
| | | *That is, it expects the given strings to exist for the duration of the object's lifetime,
|
| | | *and it expects the given strings to be immutable.
|
| | | *In other words, it does not copy these strings, it simply points to them.
|
| | | *This is due to the fact that __FILE__ and __FUNCTION__ are usually used to specify these parameters,
|
| | | *so it makes sense to optimize and skip the unnecessary allocations.
|
| | | *However, if you need them to be copied you may use the options parameter to specify this.
|
| | | *
|
| | | * @param message the message
|
| | | * @param level the log level
|
| | | * @param flag the log flag
|
| | | * @param context the context (if any is defined)
|
| | | * @param file the current file
|
| | | * @param function the current function
|
| | | * @param line the current code line
|
| | | * @param tag potential tag
|
| | | * @param options a bitmask which supports OBSDDLogMessageCopyFile and OBSDDLogMessageCopyFunction.
|
| | | * @param timestamp the log timestamp
|
| | | *
|
| | | * @return a new instance of a log message model object
|
| | | */
|
| | | - (instancetype)initWithMessage:(NSString *)message
|
| | | level:(OBSDDLogLevel)level
|
| | | flag:(OBSDDLogFlag)flag
|
| | | context:(NSInteger)context
|
| | | file:(NSString *)file
|
| | | function:(NSString *__nullable)function
|
| | | line:(NSUInteger)line
|
| | | tag:(id __nullable)tag
|
| | | options:(OBSDDLogMessageOptions)options
|
| | | timestamp:(NSDate *__nullable)timestamp NS_DESIGNATED_INITIALIZER;
|
| | |
|
| | | /**
|
| | | *Read-only properties
|
| | | **/
|
| | |
|
| | | /**
|
| | | * The log message
|
| | | */
|
| | | @property (readonly, nonatomic) NSString *message;
|
| | | @property (readonly, nonatomic) OBSDDLogLevel level;
|
| | | @property (readonly, nonatomic) OBSDDLogFlag flag;
|
| | | @property (readonly, nonatomic) NSInteger context;
|
| | | @property (readonly, nonatomic) NSString *file;
|
| | | @property (readonly, nonatomic) NSString *fileName;
|
| | | @property (readonly, nonatomic) NSString *__nullable function;
|
| | | @property (readonly, nonatomic) NSUInteger line;
|
| | | @property (readonly, nonatomic) id __nullable tag;
|
| | | @property (readonly, nonatomic) OBSDDLogMessageOptions options;
|
| | | @property (readonly, nonatomic) NSDate *timestamp;
|
| | | @property (readonly, nonatomic) NSString *threadID; // g_ID as it appears in NSLog calculated from the machThreadID
|
| | | @property (readonly, nonatomic) NSString *threadName;
|
| | | @property (readonly, nonatomic) NSString *queueLabel;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | /**
|
| | | *The `OBSDDLogger` protocol specifies that an optional formatter can be added to a logger.
|
| | | *Most (but not all) loggers will want to support formatters.
|
| | | *
|
| | | *However, writting getters and setters in a thread safe manner,
|
| | | *while still maintaining maximum speed for the logging process, is a difficult task.
|
| | | *
|
| | | *To do it right, the implementation of the getter/setter has strict requiremenets:
|
| | | *- Must NOT require the `logMessage:` method to acquire a lock.
|
| | | *- Must NOT require the `logMessage:` method to access an atomic property (also a lock of sorts).
|
| | | *
|
| | | *To simplify things, an abstract logger is provided that implements the getter and setter.
|
| | | *
|
| | | *Logger implementations may simply extend this class,
|
| | | *and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their `logMessage:` method!
|
| | | **/
|
| | | @interface OBSDDAbstractLogger : NSObject <OBSDDLogger>
|
| | | {
|
| | | // Direct accessors to be used only for performance
|
| | | @public
|
| | | id <OBSDDLogFormatter> _logFormatter;
|
| | | dispatch_queue_t _loggerQueue;
|
| | | }
|
| | |
|
| | | @property (nonatomic, strong, nullable) id <OBSDDLogFormatter> logFormatter;
|
| | | @property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue;
|
| | |
|
| | | // For thread-safety assertions
|
| | |
|
| | | /**
|
| | | * Return YES if the current logger uses a global queue for logging
|
| | | */
|
| | | @property (nonatomic, readonly, getter=isOnGlobalLoggingQueue) BOOL onGlobalLoggingQueue;
|
| | |
|
| | | /**
|
| | | * Return YES if the current logger uses the internal designated queue for logging
|
| | | */
|
| | | @property (nonatomic, readonly, getter=isOnInternalLoggerQueue) BOOL onInternalLoggerQueue;
|
| | |
|
| | | @end
|
| | |
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | | #pragma mark -
|
| | | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
| | |
|
| | | @interface OBSDDLoggerInformation : NSObject
|
| | |
|
| | | @property (nonatomic, readonly) id <OBSDDLogger> logger;
|
| | | @property (nonatomic, readonly) OBSDDLogLevel level;
|
| | |
|
| | | + (OBSDDLoggerInformation *)informationWithLogger:(id <OBSDDLogger>)logger
|
| | | andLevel:(OBSDDLogLevel)level;
|
| | |
|
| | | @end
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *The constant/variable/method responsible for controlling the current log level.
|
| | | **/
|
| | | #ifndef OBSLOG_LEVEL_DEF
|
| | | #define OBSLOG_LEVEL_DEF obsddLogLevel
|
| | | #endif
|
| | |
|
| | | /**
|
| | | *Whether async should be used by log messages, excluding error messages that are always sent sync.
|
| | | **/
|
| | | #ifndef OBSLOG_ASYNC_ENABLED
|
| | | #define OBSLOG_ASYNC_ENABLED YES
|
| | | #endif
|
| | |
|
| | | /**
|
| | | *These are the two macros that all other macros below compile into.
|
| | | *These big multiline macros makes all the other macros easier to read.
|
| | | **/
|
| | | #define OBSLOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
| | | [OBSDDLog log : isAsynchronous \
|
| | | level : lvl \
|
| | | flag : flg \
|
| | | context : ctx \
|
| | | file : __FILE__ \
|
| | | function : fnct \
|
| | | line : __LINE__ \
|
| | | tag : atag \
|
| | | format : (frmt), ## __VA_ARGS__]
|
| | |
|
| | | #define OBSLOG_MACRO_TO_OBSDDLOG(obsddlog, isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
| | | [obsddlog log : isAsynchronous \
|
| | | level : lvl \
|
| | | flag : flg \
|
| | | context : ctx \
|
| | | file : __FILE__ \
|
| | | function : fnct \
|
| | | line : __LINE__ \
|
| | | tag : atag \
|
| | | format : (frmt), ## __VA_ARGS__]
|
| | |
|
| | | /**
|
| | | *Define version of the macro that only execute if the log level is above the threshold.
|
| | | *The compiled versions essentially look like this:
|
| | | *
|
| | | *if (logFlagForThisLogMsg & obsddLogLevel) { execute log message }
|
| | | *
|
| | | *When LOG_LEVEL_DEF is defined as obsddLogLevel.
|
| | | *
|
| | | *As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels.
|
| | | *This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques.
|
| | | *
|
| | | *Note that when compiler optimizations are enabled (as they are for your release builds),
|
| | | *the log messages above your logging threshold will automatically be compiled out.
|
| | | *
|
| | | *(If the compiler sees LOG_LEVEL_DEF/obsddLogLevel declared as a constant, the compiler simply checks to see
|
| | | * if the 'if' statement would execute, and if not it strips it from the binary.)
|
| | | *
|
| | | *We also define shorthand versions for asynchronous and synchronous logging.
|
| | | **/
|
| | | #define OBSLOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \
|
| | | do { if(lvl & flg) OBSLOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
|
| | |
|
| | | #define OBSLOG_MAYBE_TO_OBSDDLOG(obsddlog, async, lvl, flg, ctx, tag, fnct, frmt, ...) \
|
| | | do { if(lvl & flg) OBSLOG_MACRO_TO_OBSDDLOG(obsddlog, async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
|
| | |
|
| | | /**
|
| | | *Ready to use log macros with no context or tag.
|
| | | **/
|
| | | #define OBSDDLogError(frmt, ...) OBSLOG_MAYBE(NO, OBSDDLogLevelError, OBSDDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogWarn(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSDDLogLevelWarn, OBSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogInfo(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSDDLogLevelInfo, OBSDDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogDebug(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSDDLogLevelDebug, OBSDDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogVerbose(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSDDLogLevelVerbose, OBSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | |
|
| | | // default macro
|
| | | /*
|
| | | #define DDLogError(frmt, ...) LOG_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define DDLogWarn(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define DDLogInfo(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define DDLogDebug(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define DDLogVerbose(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | */
|
| | |
|
| | | #define OBSDDLogErrorToOBSDDLog(obsddlog, frmt, ...) OBSLOG_MAYBE_TO_OBSDDOBSLOG(obsddlog, NO, OBSLOG_LEVEL_DEF, OBSDDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogWarnToOBSDDLog(obsddlog, frmt, ...) OBSLOG_MAYBE_TO_OBSDDOBSLOG(obsddlog, OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogInfoToOBSDDLog(obsddlog, frmt, ...) OBSLOG_MAYBE_TO_OBSDDOBSLOG(obsddlog, OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogDebugToOBSDDLog(obsddlog, frmt, ...) OBSLOG_MAYBE_TO_OBSDDOBSLOG(obsddlog, OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
| | | #define OBSDDLogVerboseToOBSDDLog(obsddlog, frmt, ...) OBSLOG_MAYBE_TO_OBSDDOBSLOG(obsddlog, OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *This formatter can be used to chain different formatters together.
|
| | | *The log message will processed in the order of the formatters added.
|
| | | **/
|
| | | @interface OBSDDMultiFormatter : NSObject <OBSDDLogFormatter>
|
| | |
|
| | | /**
|
| | | * Array of chained formatters
|
| | | */
|
| | | @property (readonly) NSArray<id<OBSDDLogFormatter>> *formatters;
|
| | |
|
| | | /**
|
| | | * Add a new formatter
|
| | | */
|
| | | - (void)addFormatter:(id<OBSDDLogFormatter>)formatter NS_SWIFT_NAME(add(_:));
|
| | |
|
| | | /**
|
| | | * Remove a formatter
|
| | | */
|
| | | - (void)removeFormatter:(id<OBSDDLogFormatter>)formatter NS_SWIFT_NAME(remove(_:));
|
| | |
|
| | | /**
|
| | | * Remove all existing formatters
|
| | | */
|
| | | - (void)removeAllFormatters NS_SWIFT_NAME(removeAll());
|
| | |
|
| | | /**
|
| | | * Check if a certain formatter is used
|
| | | */
|
| | | - (BOOL)isFormattingWithFormatter:(id<OBSDDLogFormatter>)formatter;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | /**
|
| | | *This class provides a logger for the Apple os_log facility.
|
| | | **/
|
| | | API_AVAILABLE(ios(10.0), macos(10.12), tvos(10.0), watchos(3.0))
|
| | | @interface OBSDDOSLogger : OBSDDAbstractLogger <OBSDDLogger>
|
| | |
|
| | | /**
|
| | | * Singleton method
|
| | | *
|
| | | * @return the shared instance
|
| | | */
|
| | | @property (class, readonly, strong) OBSDDOSLogger *sharedInstance;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Software License Agreement (BSD License)
|
| | | //
|
| | | // Copyright (c) 2010-2016, Deusty, LLC
|
| | | // All rights reserved.
|
| | | //
|
| | | // Redistribution and use of this software in source and binary forms,
|
| | | // with or without modification, are permitted provided that the following conditions are met:
|
| | | //
|
| | | // *Redistributions of source code must retain the above copyright notice,
|
| | | // this list of conditions and the following disclaimer.
|
| | | //
|
| | | // *Neither the name of Deusty nor the names of its contributors may be used
|
| | | // to endorse or promote products derived from this software without specific
|
| | | // prior written permission of Deusty, LLC.
|
| | |
|
| | | // Disable legacy macros
|
| | | #ifndef OBSDD_LEGACY_MACROS
|
| | | #define OBSDD_LEGACY_MACROS 0
|
| | | #endif
|
| | |
|
| | | #import "OBSDDLog.h"
|
| | |
|
| | | #define LOG_CONTEXT_ALL INT_MAX
|
| | |
|
| | | #pragma clang diagnostic push
|
| | | #pragma clang diagnostic ignored "-Wunused-function"
|
| | | #if !(TARGET_OS_OSX)
|
| | | // iOS or tvOS or watchOS
|
| | | #import <UIKit/UIColor.h>
|
| | | typedef UIColor OBSDDColor;
|
| | | static inline OBSDDColor *OBSDDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [OBSDDColor colorWithRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
| | | #elif defined(OBSDD_CLI) || !__has_include(<AppKit/NSColor.h>)
|
| | | // OS X CLI
|
| | | #import "OBSCLIColor.h"
|
| | | typedef OBSCLIColor OBSDDColor;
|
| | | static inline OBSDDColor *OBSDDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [OBSDDColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
| | | #else
|
| | | // OS X with AppKit
|
| | | #import <AppKit/NSColor.h>
|
| | | typedef NSColor OBSDDColor;
|
| | | static inline OBSDDColor *OBSDDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [OBSDDColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
| | | #endif
|
| | | #pragma clang diagnostic pop
|
| | |
|
| | |
|
| | | /**
|
| | | *This class provides a logger for Terminal output or Xcode console output,
|
| | | *depending on where you are running your code.
|
| | | *
|
| | | *As described in the "Getting Started" page,
|
| | | *the traditional NSLog() function directs it's output to two places:
|
| | | *
|
| | | *- Apple System Log (so it shows up in Console.app)
|
| | | *- StdErr (if stderr is a TTY, so log statements show up in Xcode console)
|
| | | *
|
| | | *To duplicate NSLog() functionality you can simply add this logger and an asl logger.
|
| | | *However, if you instead choose to use file logging (for faster performance),
|
| | | *you may choose to use only a file logger and a tty logger.
|
| | | **/
|
| | | @interface OBSDDTTYLogger : OBSDDAbstractLogger <OBSDDLogger>
|
| | |
|
| | | /**
|
| | | * Singleton method
|
| | | */
|
| | | @property (class, readonly, strong) OBSDDTTYLogger *sharedInstance;
|
| | |
|
| | | /* Inherited from the OBSDDLogger protocol:
|
| | | *
|
| | | *Formatters may optionally be added to any logger.
|
| | | *
|
| | | *If no formatter is set, the logger simply logs the message as it is given in logMessage,
|
| | | *or it may use its own built in formatting style.
|
| | | *
|
| | | *More information about formatters can be found here:
|
| | | *Documentation/CustomFormatters.md
|
| | | *
|
| | | *The actual implementation of these methods is inherited from OBSDDAbstractLogger.
|
| | |
|
| | | - (id <OBSDDLogFormatter>)logFormatter;
|
| | | - (void)setLogFormatter:(id <OBSDDLogFormatter>)formatter;
|
| | |
|
| | | */
|
| | |
|
| | | /**
|
| | | *Want to use different colors for different log levels?
|
| | | *Enable this property.
|
| | | *
|
| | | *If you run the application via the Terminal (not Xcode),
|
| | | *the logger will map colors to xterm-256color or xterm-color (if available).
|
| | | *
|
| | | *Xcode does NOT natively support colors in the Xcode debugging console.
|
| | | *You'll need to install the XcodeColors plugin to see colors in the Xcode console.
|
| | | *https://github.com/robbiehanson/XcodeColors
|
| | | *
|
| | | *The default value is NO.
|
| | | **/
|
| | | @property (readwrite, assign) BOOL colorsEnabled;
|
| | |
|
| | | /**
|
| | | *When using a custom formatter you can set the `logMessage` method not to append
|
| | | *`\n` character after each output. This allows for some greater flexibility with
|
| | | *custom formatters. Default value is YES.
|
| | | **/
|
| | | @property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters;
|
| | |
|
| | | /**
|
| | | *The default color set (foregroundColor, backgroundColor) is:
|
| | | *
|
| | | *- OBSDDLogFlagError = (red, nil)
|
| | | *- OBSDDLogFlagWarning = (orange, nil)
|
| | | *
|
| | | *You can customize the colors however you see fit.
|
| | | *Please note that you are passing a flag, NOT a level.
|
| | | *
|
| | | *GOOD : [ttyLogger setForegroundColor:pink backgroundColor:nil forFlag:OBSDDLogFlagInfo]; // <- Good :)
|
| | | * BAD : [ttyLogger setForegroundColor:pink backgroundColor:nil forFlag:OBSDDLogLevelInfo]; // <- BAD! :(
|
| | | *
|
| | | *OBSDDLogFlagInfo = 0...00100
|
| | | *OBSDDLogLevelInfo = 0...00111 <- Would match OBSDDLogFlagInfo and OBSDDLogFlagWarning and OBSDDLogFlagError
|
| | | *
|
| | | *If you run the application within Xcode, then the XcodeColors plugin is required.
|
| | | *
|
| | | *If you run the application from a shell, then OBSDDTTYLogger will automatically map the given color to
|
| | | *the closest available color. (xterm-256color or xterm-color which have 256 and 16 supported colors respectively.)
|
| | | *
|
| | | *This method invokes setForegroundColor:backgroundColor:forFlag:context: and applies it to `LOG_CONTEXT_ALL`.
|
| | | **/
|
| | | - (void)setForegroundColor:(OBSDDColor *)txtColor backgroundColor:(OBSDDColor *)bgColor forFlag:(OBSDDLogFlag)mask;
|
| | |
|
| | | /**
|
| | | *Just like setForegroundColor:backgroundColor:flag, but allows you to specify a particular logging context.
|
| | | *
|
| | | *A logging context is often used to identify log messages coming from a 3rd party framework,
|
| | | *although logging context's can be used for many different functions.
|
| | | *
|
| | | *Use LOG_CONTEXT_ALL to set the deafult color for all contexts that have no specific color set defined.
|
| | | *
|
| | | *Logging context's are explained in further detail here:
|
| | | *Documentation/CustomContext.md
|
| | | **/
|
| | | - (void)setForegroundColor:(OBSDDColor *)txtColor backgroundColor:(OBSDDColor *)bgColor forFlag:(OBSDDLogFlag)mask context:(NSInteger)ctxt;
|
| | |
|
| | | /**
|
| | | *Similar to the methods above, but allows you to map OBSDDLogMessage->tag to a particular color profile.
|
| | | *For example, you could do something like this:
|
| | | *
|
| | | *static NSString *const PurpleTag = @"PurpleTag";
|
| | | *
|
| | | *#define OBSDDLogPurple(frmt, ...) LOG_OBJC_TAG_MACRO(NO, 0, 0, 0, PurpleTag, frmt, ##__VA_ARGS__)
|
| | | *
|
| | | *And then where you configure CocoaLumberjack:
|
| | | *
|
| | | *purple = OBSDDMakeColor((64/255.0), (0/255.0), (128/255.0));
|
| | | *
|
| | | *or any UIColor/NSColor constructor.
|
| | | *
|
| | | *Note: For CLI OS X projects that don't link with AppKit use CLIColor objects instead
|
| | | *
|
| | | *[[OBSDDTTYLogger sharedInstance] setForegroundColor:purple backgroundColor:nil forTag:PurpleTag];
|
| | | *[OBSDDLog addLogger:[OBSDDTTYLogger sharedInstance]];
|
| | | *
|
| | | *This would essentially give you a straight NSLog replacement that prints in purple:
|
| | | *
|
| | | *OBSDDLogPurple(@"I'm a purple log message!");
|
| | | **/
|
| | | - (void)setForegroundColor:(OBSDDColor *)txtColor backgroundColor:(OBSDDColor *)bgColor forTag:(id <NSCopying>)tag;
|
| | |
|
| | | /**
|
| | | *Clearing color profiles.
|
| | | **/
|
| | | - (void)clearColorsForFlag:(OBSDDLogFlag)mask;
|
| | | - (void)clearColorsForFlag:(OBSDDLogFlag)mask context:(NSInteger)context;
|
| | | - (void)clearColorsForTag:(id <NSCopying>)tag;
|
| | | - (void)clearColorsForAllFlags;
|
| | | - (void)clearColorsForAllTags;
|
| | | - (void)clearAllColors;
|
| | |
|
| | | @end
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteBucketCORSModel_h |
| | | #define OBSDeleteBucketCORSModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除桶CORS |
| | | */ |
| | | @protocol OBSDeleteBucketCORSProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | /** |
| | | 删除桶CORS request |
| | | */ |
| | | @interface OBSDeleteBucketCORSRequest: OBSBaseRequest<OBSDeleteBucketCORSProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除桶CORS request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除桶CORS request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketCORSRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除桶CORS response |
| | | */ |
| | | @interface OBSDeleteBucketCORSResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucketCORS) |
| | | |
| | | /** |
| | | 删除桶CORS |
| | | |
| | | @param request 删除桶CORS request |
| | | @param completionHandler 删除桶CORS回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucketCORS:(__kindof OBSBaseRequest<OBSDeleteBucketCORSProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketCORSResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSDeleteBucketCORSModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteBucketLifecycleModel_h |
| | | #define OBSDeleteBucketLifecycleModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除桶的生命周期 |
| | | */ |
| | | @protocol OBSDeleteBucketLifecycleProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除桶生命周期request |
| | | */ |
| | | @interface OBSDeleteBucketLifecycleRequest: OBSBaseRequest<OBSDeleteBucketLifecycleProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除桶生命周期的request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除桶生命周期request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketLifecycleRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | @interface OBSDeleteBucketLifecycleResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucketLifecycle) |
| | | |
| | | /** |
| | | 删除桶的生命周期 |
| | | |
| | | @param request 删除桶的生命周期的request |
| | | @param completionHandler 删除桶的生命周期回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucketLifecycle:(__kindof OBSBaseRequest<OBSDeleteBucketLifecycleProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketLifecycleResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteBucketLifecycleModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | #ifndef OBSDeleteBucketModel_h |
| | | #define OBSDeleteBucketModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除桶 |
| | | */ |
| | | @protocol OBSDeleteBucketProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除桶request |
| | | */ |
| | | @interface OBSDeleteBucketRequest: OBSBaseRequest<OBSDeleteBucketProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除桶request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除桶request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除桶response |
| | | */ |
| | | @interface OBSDeleteBucketResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucket) |
| | | |
| | | /** |
| | | 删除桶 |
| | | |
| | | @param request 删除桶request |
| | | @param completionHandler 删除桶回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucket:(__kindof OBSBaseRequest<OBSDeleteBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteBucketModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteBucketPolicyModel_h |
| | | #define OBSDeleteBucketPolicyModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除桶策略 |
| | | */ |
| | | @protocol OBSDeleteBucketPolicyProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | /** |
| | | 删除桶策略 |
| | | */ |
| | | @interface OBSDeleteBucketPolicyRequest: OBSBaseRequest<OBSDeleteBucketPolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除桶策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除桶策略request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketPolicyRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除桶策略response |
| | | */ |
| | | @interface OBSDeleteBucketPolicyResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucketPolicy) |
| | | |
| | | /** |
| | | 删除桶策略 |
| | | |
| | | @param request 删除桶策略request |
| | | @param completionHandler 删除桶策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucketPolicy:(__kindof OBSBaseRequest<OBSDeleteBucketPolicyProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketPolicyResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteBucketPolicyModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteBucketTaggingModel_h |
| | | #define OBSDeleteBucketTaggingModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除桶标签 |
| | | */ |
| | | @protocol OBSDeleteBucketTaggingProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除桶标签request |
| | | */ |
| | | @interface OBSDeleteBucketTaggingRequest: OBSBaseRequest<OBSDeleteBucketTaggingProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除桶标签request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除桶标签request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketTaggingRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除桶标签response |
| | | */ |
| | | @interface OBSDeleteBucketTaggingResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucketTagging) |
| | | |
| | | /** |
| | | 删除桶标签 |
| | | |
| | | @param request 删除桶标签request |
| | | @param completionHandler 删除桶标签回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucketTagging:(__kindof OBSBaseRequest<OBSDeleteBucketTaggingProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketTaggingResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteBucketTaggingModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteBucketWebsiteModel_h |
| | | #define OBSDeleteBucketWebsiteModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除网站托管配置 |
| | | */ |
| | | @protocol OBSDeleteBucketWebsiteProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除网站托管配置request |
| | | */ |
| | | @interface OBSDeleteBucketWebsiteRequest: OBSBaseRequest<OBSDeleteBucketWebsiteProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化删除网站托管配置request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 删除网站托管配置request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteBucketWebsiteRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除网站托管配置response |
| | | */ |
| | | @interface OBSDeleteBucketWebsiteResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteBucketWebsite) |
| | | |
| | | /** |
| | | 删除托管配置 |
| | | |
| | | @param request 删除托管配置request |
| | | @param completionHandler 删除托管配置回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteBucketWebsite:(__kindof OBSBaseRequest<OBSDeleteBucketWebsiteProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteBucketWebsiteResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteBucketWebsiteModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteObjectModel_h |
| | | #define OBSDeleteObjectModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 删除对象 |
| | | */ |
| | | @protocol OBSDeleteObjectProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除对象request |
| | | */ |
| | | @interface OBSDeleteObjectRequest: OBSBaseRequest<OBSDeleteObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 初始化删除对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @return 删除对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteObjectRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除对象response |
| | | */ |
| | | @interface OBSDeleteObjectResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 删除标记 |
| | | */ |
| | | @property (nonatomic, assign) BOOL deleteMarker; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteObject) |
| | | |
| | | /** |
| | | 删除对象 |
| | | |
| | | @param request 删除对象request |
| | | @param completionHandler 删除对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteObject:(__kindof OBSBaseRequest<OBSDeleteObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteObjectModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteObjectssModel_h |
| | | #define OBSDeleteObjectssModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entity |
| | | @interface OBSObjectToDelete : OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | -(instancetype)initWithObjectKey:(NSString*) key; |
| | | -(instancetype)initWithObjectKey:(NSString*) key versionID:(NSString*)versionID; |
| | | @end |
| | | |
| | | @interface OBSObjectDeleted : OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @property (nonatomic, assign) BOOL deleteMarker; |
| | | @property (nonatomic, strong, nonnull) NSString *deleteMarkerVersionID; |
| | | @end |
| | | |
| | | @interface OBSObjectDeleteError : OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *code; |
| | | @property (nonatomic, strong, nonnull) NSString *message; |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 批量删除对象 |
| | | */ |
| | | @protocol OBSDeleteObjectsProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | quiet模式:只返回删除失败的对象结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL quiet; |
| | | |
| | | /** |
| | | 删除对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSObjectToDelete*> *objectList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 批量删除对象request |
| | | */ |
| | | @interface OBSDeleteObjectsRequest: OBSBaseRequest<OBSDeleteObjectsProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | quiet模式:只返回删除失败的对象结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL quiet; |
| | | |
| | | /** |
| | | 被批量删除对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSObjectToDelete*> *objectList; |
| | | |
| | | /** |
| | | 初始化批量删除对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 批量删除对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteObjectsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | /** |
| | | 批量删除对象response |
| | | */ |
| | | @interface OBSDeleteObjectsResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 成功删除对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSObjectDeleted*> *deletedList; |
| | | |
| | | /** |
| | | 删除失败对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSObjectDeleteError*> *errorList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteObjects) |
| | | |
| | | /** |
| | | 批量删除对象 |
| | | |
| | | @param request 批量删除对象request |
| | | @param completionHandler 批量删除对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)deleteObjects:(__kindof OBSBaseRequest<OBSDeleteObjectsProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteObjectsResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDeleteObjectssModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDeleteReplicateBucketModel_h |
| | | #define OBSDeleteReplicateBucketModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | //request |
| | | #pragma mark - request entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | |
| | | /** |
| | | 删除桶的跨域复制 |
| | | */ |
| | | @protocol OBSDeleteReplicateBucketProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 删除桶的跨域复制request |
| | | */ |
| | | @interface OBSDeleteReplicateBucketRequest: OBSBaseRequest<OBSDeleteReplicateBucketProtocol> |
| | | |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | 初始化删除跨域复制桶的request |
| | | |
| | | @param bucketName 桶名 |
| | | |
| | | @return 删除跨域复制桶的request |
| | | */ |
| | | |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSDeleteReplicateBucketRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 删除桶的跨域复制response |
| | | */ |
| | | @interface OBSDeleteReplicateBucketResponse: OBSServiceResponse |
| | | |
| | | |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(deleteReplicateBucket) |
| | | |
| | | /** |
| | | 删除桶的跨域复制 |
| | | |
| | | @param request 删除桶的跨域复制request对象 |
| | | @param completionHandler 删除桶的跨域复制的回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)deleteReplicateBucket:(__kindof OBSBaseRequest<OBSDeleteReplicateBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSDeleteReplicateBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceBaseModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSDownloadFileModel_h |
| | | #define OBSDownloadFileModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | @class OBSAbstractEncryption; |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 断点续传下载 |
| | | */ |
| | | @protocol OBSDownloadFileProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | //resource parameters |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | //header parameters |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifModifiedSince; |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后没有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifUnmodifiedSince; |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定的eTag相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagMatch; |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定的eTag不相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagNoneMatch; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 下载文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *downloadFilePath; |
| | | |
| | | /** |
| | | 下载进度 |
| | | */ |
| | | @property (atomic, copy, nonnull) OBSNetworkingDownloadProgressBlock downloadProgressBlock; |
| | | |
| | | /** |
| | | 是否开启断点续传 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableCheckpoint; |
| | | |
| | | /** |
| | | 是否开启MD5校验 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableMD5Check; |
| | | |
| | | /** |
| | | 是否打开强制覆盖 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableForceOverwrite; |
| | | |
| | | /** |
| | | 设置断点续传模式下,记录下载进度的文件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *checkpointFilePath; |
| | | |
| | | /** |
| | | 分段大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partSize; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 断点续传下载request |
| | | */ |
| | | @interface OBSDownloadFileRequest: OBSBaseRequest<OBSDownloadFileProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifModifiedSince; |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后没有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifUnmodifiedSince; |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定的eTag相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagMatch; |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定的eTag不相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagNoneMatch; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 保存文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *downloadFilePath; |
| | | |
| | | /** |
| | | 下载文件回调 |
| | | */ |
| | | @property (atomic, copy, nonnull) OBSNetworkingDownloadProgressBlock downloadProgressBlock; |
| | | |
| | | /** |
| | | 是否支持断点传续 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableCheckpoint; |
| | | |
| | | /** |
| | | 是否打开MD5校验 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableMD5Check; |
| | | |
| | | /** |
| | | 是否开启强制覆盖 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableForceOverwrite; |
| | | |
| | | /** |
| | | 设置断点续传模式下,记录下载进度的文件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *checkpointFilePath; |
| | | |
| | | /** |
| | | 分段大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partSize; |
| | | |
| | | /** |
| | | 初始化断点续传下载request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象key |
| | | @param downloadFilePath 存储路径 |
| | | @return 断点续传下载request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey downloadFilePath:(NSString*) downloadFilePath; |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 断点续传下载response |
| | | */ |
| | | @interface OBSDownloadFileResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 对象etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 过期时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *expiration; |
| | | |
| | | /** |
| | | 网址重定向 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 最后修改时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | |
| | | /** |
| | | 删除标记 |
| | | */ |
| | | @property (nonatomic, assign) BOOL deleteMarker; |
| | | |
| | | /** |
| | | 如果桶开启了多版本,则返回多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(downloadFile) |
| | | |
| | | /** |
| | | 下载文件 |
| | | |
| | | @param request 断点续传下载request |
| | | @param completionHandler 断点续传下载回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)downloadFile:(__kindof OBSBaseRequest<OBSDownloadFileProtocol>*)request |
| | | completionHandler:(void (^)(OBSDownloadFileResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSDownloadFileModel_h */ |
New file |
| | |
| | | //
|
| | | // EXTKeyPathCoding.h
|
| | | // extobjc
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 19.06.12.
|
| | | // Copyright (C) 2012 Justin Spahr-Summers.
|
| | | // Released under the MIT license.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #import "OBSmetamacros.h"
|
| | |
|
| | | /**
|
| | | *\@keypath allows compile-time verification of key paths. Given a real object
|
| | | *receiver and key path:
|
| | | *
|
| | | *@code
|
| | |
|
| | | NSString *UTF8StringPath = @keypath(str.lowercaseString.UTF8String);
|
| | | // => @"lowercaseString.UTF8String"
|
| | |
|
| | | NSString *versionPath = @keypath(NSObject, version);
|
| | | // => @"version"
|
| | |
|
| | | NSString *lowercaseStringPath = @keypath(NSString.new, lowercaseString);
|
| | | // => @"lowercaseString"
|
| | |
|
| | | *@endcode
|
| | | *
|
| | | *... the macro returns an \c NSString containing all but the first path
|
| | | *component or argument (e.g., @"lowercaseString.UTF8String", @"version").
|
| | | *
|
| | | *In addition to simply creating a key path, this macro ensures that the key
|
| | | *path is valid at compile-time (causing a syntax error if not), and supports
|
| | | *refactoring, such that changing the name of the property will also update any
|
| | | *uses of \@keypath.
|
| | | */
|
| | | #define obs_keypath(...) \
|
| | | obs_metamacro_if_eq(1, obs_metamacro_argcount(__VA_ARGS__))(obs_keypath1(__VA_ARGS__))(obs_keypath2(__VA_ARGS__))
|
| | |
|
| | | #define obs_keypath1(PATH) \
|
| | | (((void)(NO && ((void)PATH, NO)), strchr(# PATH, '.') + 1))
|
| | |
|
| | | #define obs_keypath2(OBJ, PATH) \
|
| | | (((void)(NO && ((void)OBJ.PATH, NO)), # PATH))
|
| | |
|
| | | /**
|
| | | *\@collectionKeypath allows compile-time verification of key paths across collections NSArray/NSSet etc. Given a real object
|
| | | *receiver, collection object receiver and related keypaths:
|
| | | *
|
| | | *@code
|
| | | |
| | | NSString *employeesFirstNamePath = @collectionKeypath(department.employees, Employee.new, firstName)
|
| | | // => @"employees.firstName"
|
| | | |
| | | NSString *employeesFirstNamePath = @collectionKeypath(Department.new, employees, Employee.new, firstName)
|
| | | // => @"employees.firstName"
|
| | |
|
| | | *@endcode
|
| | | *
|
| | | */
|
| | | #define obs_collectionKeypath(...) \
|
| | | obs_metamacro_if_eq(3, obs_metamacro_argcount(__VA_ARGS__))(obs_collectionKeypath3(__VA_ARGS__))(obs_collectionKeypath4(__VA_ARGS__))
|
| | |
|
| | | #define obs_collectionKeypath3(PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",obs_keypath(PATH), obs_keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String])
|
| | |
|
| | | #define obs_collectionKeypath4(OBJ, PATH, COLLECTION_OBJECT, COLLECTION_PATH) ([[NSString stringWithFormat:@"%s.%s",obs_keypath(OBJ, PATH), obs_keypath(COLLECTION_OBJECT, COLLECTION_PATH)] UTF8String])
|
| | |
|
New file |
| | |
| | | //
|
| | | // EXTRuntimeExtensions.h
|
| | | // extobjc
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2011-03-05.
|
| | | // Copyright (C) 2012 Justin Spahr-Summers.
|
| | | // Released under the MIT license.
|
| | | //
|
| | |
|
| | | #import <objc/runtime.h>
|
| | |
|
| | | /**
|
| | | *Describes the memory management policy of a property.
|
| | | */
|
| | | typedef enum {
|
| | | /**
|
| | | *The value is assigned.
|
| | | */
|
| | | obs_mtl_propertyMemoryManagementPolicyAssign = 0,
|
| | |
|
| | | /**
|
| | | *The value is retained.
|
| | | */
|
| | | obs_mtl_propertyMemoryManagementPolicyRetain,
|
| | |
|
| | | /**
|
| | | *The value is copied.
|
| | | */
|
| | | obs_mtl_propertyMemoryManagementPolicyCopy
|
| | | } obs_mtl_propertyMemoryManagementPolicy;
|
| | |
|
| | | /**
|
| | | *Describes the attributes and type information of a property.
|
| | | */
|
| | | typedef struct {
|
| | | /**
|
| | | *Whether this property was declared with the \c readonly attribute.
|
| | | */
|
| | | BOOL readonly;
|
| | |
|
| | | /**
|
| | | *Whether this property was declared with the \c nonatomic attribute.
|
| | | */
|
| | | BOOL nonatomic;
|
| | |
|
| | | /**
|
| | | *Whether the property is a weak reference.
|
| | | */
|
| | | BOOL weak;
|
| | |
|
| | | /**
|
| | | *Whether the property is eligible for garbage collection.
|
| | | */
|
| | | BOOL canBeCollected;
|
| | |
|
| | | /**
|
| | | *Whether this property is defined with \c \@dynamic.
|
| | | */
|
| | | BOOL dynamic;
|
| | |
|
| | | /**
|
| | | *The memory management policy for this property. This will always be
|
| | | *#obs_mtl_propertyMemoryManagementPolicyAssign if #readonly is \c YES.
|
| | | */
|
| | | obs_mtl_propertyMemoryManagementPolicy memoryManagementPolicy;
|
| | |
|
| | | /**
|
| | | *The selector for the getter of this property. This will reflect any
|
| | | *custom \c getter= attribute provided in the property declaration, or the
|
| | | *inferred getter name otherwise.
|
| | | */
|
| | | SEL getter;
|
| | |
|
| | | /**
|
| | | *The selector for the setter of this property. This will reflect any
|
| | | *custom \c setter= attribute provided in the property declaration, or the
|
| | | *inferred setter name otherwise.
|
| | | *
|
| | | *@note If #readonly is \c YES, this value will represent what the setter
|
| | | *\e would be, if the property were writable.
|
| | | */
|
| | | SEL setter;
|
| | |
|
| | | /**
|
| | | *The backing instance variable for this property, or \c NULL if \c
|
| | | *\c @synthesize was not used, and therefore no instance variable exists. This
|
| | | *would also be the case if the property is implemented dynamically.
|
| | | */
|
| | | const char *ivar;
|
| | |
|
| | | /**
|
| | | *If this property is defined as being an instance of a specific class,
|
| | | *this will be the class object representing it.
|
| | | *
|
| | | *This will be \c nil if the property was defined as type \c id, if the
|
| | | *property is not of an object type, or if the class could not be found at
|
| | | *runtime.
|
| | | */
|
| | | Class objectClass;
|
| | |
|
| | | /**
|
| | | *The type encoding for the value of this property. This is the type as it
|
| | | *would be returned by the \c \@encode() directive.
|
| | | */
|
| | | char type[];
|
| | | } obs_mtl_propertyAttributes;
|
| | |
|
| | | /**
|
| | | *Returns a pointer to a structure containing information about \a property.
|
| | | *You must \c free() the returned pointer. Returns \c NULL if there is an error
|
| | | *obtaining information from \a property.
|
| | | */
|
| | | obs_mtl_propertyAttributes *obs_mtl_copyPropertyAttributes (objc_property_t property);
|
New file |
| | |
| | | //
|
| | | // EXTScope.h
|
| | | // extobjc
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2011-05-04.
|
| | | // Copyright (C) 2012 Justin Spahr-Summers.
|
| | | // Released under the MIT license.
|
| | | //
|
| | |
|
| | | #import "OBSmetamacros.h"
|
| | |
|
| | | /**
|
| | | *\@onExit defines some code to be executed when the current scope exits. The
|
| | | *code must be enclosed in braces and terminated with a semicolon, and will be
|
| | | *executed regardless of how the scope is exited, including from exceptions,
|
| | | *\c goto, \c return, \c break, and \c continue.
|
| | | *
|
| | | *Provided code will go into a block to be executed later. Keep this in mind as
|
| | | *it pertains to memory management, restrictions on assignment, etc. Because
|
| | | *the code is used within a block, \c return is a legal (though perhaps
|
| | | *confusing) way to exit the cleanup block early.
|
| | | *
|
| | | *Multiple \@onExit statements in the same scope are executed in reverse
|
| | | *lexical order. This helps when pairing resource acquisition with \@onExit
|
| | | *statements, as it guarantees teardown in the opposite order of acquisition.
|
| | | *
|
| | | *@note This statement cannot be used within scopes defined without braces
|
| | | *(like a one line \c if). In practice, this is not an issue, since \@onExit is
|
| | | *a useless construct in such a case anyways.
|
| | | */
|
| | | #define obs_onExit \
|
| | | try {} @finally {} \
|
| | | __strong obs_mtl_cleanupBlock_t obs_metamacro_concat(obs_mtl_exitBlock_, __LINE__) __attribute__((cleanup(obs_mtl_executeCleanupBlock), unused)) = ^
|
| | |
|
| | | /**
|
| | | *Creates \c __weak shadow variables for each of the variables provided as
|
| | | *arguments, which can later be made strong again with #strongify.
|
| | | *
|
| | | *This is typically used to weakly reference variables in a block, but then
|
| | | *ensure that the variables stay alive during the actual execution of the block
|
| | | *(if they were live upon entry).
|
| | | *
|
| | | *See #strongify for an example of usage.
|
| | | */
|
| | | #define obs_weakify(...) \
|
| | | try {} @finally {} \
|
| | | obs_metamacro_foreach_cxt(obs_mtl_weakify_,, __weak, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Like #weakify, but uses \c __unsafe_unretained instead, for targets or
|
| | | *classes that do not support weak references.
|
| | | */
|
| | | #define obs_unsafeify(...) \
|
| | | try {} @finally {} \
|
| | | obs_metamacro_foreach_cxt(obs_mtl_weakify_,, __unsafe_unretained, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Strongly references each of the variables provided as arguments, which must
|
| | | *have previously been passed to #weakify.
|
| | | *
|
| | | *The strong references created will shadow the original variable names, such
|
| | | *that the original names can be used without issue (and a significantly
|
| | | *reduced risk of retain cycles) in the current scope.
|
| | | *
|
| | | *@code
|
| | |
|
| | | id foo = [[NSObject alloc] init];
|
| | | id bar = [[NSObject alloc] init];
|
| | |
|
| | | @weakify(foo, bar);
|
| | |
|
| | | // this block will not keep 'foo' or 'bar' alive
|
| | | BOOL (^matchesFooOrBar)(id) = ^ BOOL (id obj){
|
| | | // but now, upon entry, 'foo' and 'bar' will stay alive until the block has
|
| | | // finished executing
|
| | | @strongify(foo, bar);
|
| | |
|
| | | return [foo isEqual:obj] || [bar isEqual:obj];
|
| | | };
|
| | |
|
| | | *@endcode
|
| | | */
|
| | | #define obs_strongify(...) \
|
| | | try {} @finally {} \
|
| | | _Pragma("clang diagnostic push") \
|
| | | _Pragma("clang diagnostic ignored \"-Wshadow\"") \
|
| | | obs_metamacro_foreach(obs_mtl_strongify_,, __VA_ARGS__) \
|
| | | _Pragma("clang diagnostic pop")
|
| | |
|
| | | /** *implementation details follow ***/
|
| | | typedef void (^obs_mtl_cleanupBlock_t)();
|
| | |
|
| | | void obs_mtl_executeCleanupBlock (__strong obs_mtl_cleanupBlock_t *block);
|
| | |
|
| | | #define obs_mtl_weakify_(INDEX, CONTEXT, VAR) \
|
| | | CONTEXT __typeof__(VAR) obs_metamacro_concat(VAR, _weak_) = (VAR);
|
| | |
|
| | | #define obs_mtl_strongify_(INDEX, VAR) \
|
| | | __strong __typeof__(VAR) VAR = obs_metamacro_concat(VAR, _weak_);
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketACLModel_h |
| | | #define OBSGetBucketACLModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶的访问策略 |
| | | */ |
| | | @protocol OBSGetBucketACLProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶的访问策略 |
| | | */ |
| | | @interface OBSGetBucketACLRequest: OBSBaseRequest<OBSGetBucketACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶的访问策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶的访问策略request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName ; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketACLRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶的访问策略response |
| | | */ |
| | | @interface OBSGetBucketACLResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶访问策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSAccessControlPolicy *accessControlPolicy; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketACL) |
| | | |
| | | /** |
| | | 获取桶的访问策略 |
| | | |
| | | @param request 获取桶的访问策略request |
| | | @param completionHandler 获取桶的访问策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketACL:(__kindof OBSBaseRequest<OBSGetBucketACLProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketACLResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketACLModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketCORSModel_h |
| | | #define OBSGetBucketCORSModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶的CORS配置 |
| | | */ |
| | | @protocol OBSGetBucketCORSProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶的CORS配置request |
| | | */ |
| | | @interface OBSGetBucketCORSRequest: OBSBaseRequest<OBSGetBucketCORSProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶的CORS配置request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶CORS配置request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketCORSRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶CORS配置response |
| | | */ |
| | | @interface OBSGetBucketCORSResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | CORS配置列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSCORSRule*> *bucketCORSRuleList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketCORS) |
| | | |
| | | /** |
| | | 获取桶CORS |
| | | |
| | | @param request 获取桶CORS request |
| | | @param completionHandler 获取桶CORS回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketCORS:(__kindof OBSBaseRequest<OBSGetBucketCORSProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketCORSResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetBucketCORSModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketLifecycleModel_h |
| | | #define OBSGetBucketLifecycleModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶生命周期 |
| | | */ |
| | | @protocol OBSGetBucketLifecycleProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶生命周期的request |
| | | */ |
| | | @interface OBSGetBucketLifecycleRequest: OBSBaseRequest<OBSGetBucketLifecycleProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶生命周期的request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶生命周期request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketLifecycleRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶生命周期response |
| | | */ |
| | | @interface OBSGetBucketLifecycleResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶生命周期列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLifecycleRule*> *lifecycleRuleList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketLifecycle) |
| | | |
| | | /** |
| | | 获取桶的生命周期 |
| | | |
| | | @param request 获取桶生命周期request |
| | | @param completionHandler 获取桶生命周期回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketLifecycle:(__kindof OBSBaseRequest<OBSGetBucketLifecycleProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketLifecycleResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetBucketLifecycleModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketLocationModel_h |
| | | #define OBSGetBucketLocationModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | @class OBSEncryptionTypeCustomer; |
| | | |
| | | /** |
| | | 获取桶区域 |
| | | */ |
| | | @protocol OBSGetBucketLocationProtocol <NSObject> |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶区域 |
| | | */ |
| | | @interface OBSGetBucketLocationRequest : OBSBaseRequest<OBSGetBucketLocationProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 获取桶区域request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶位置request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingGetBucketLocationRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶区域response |
| | | */ |
| | | @interface OBSGetBucketLocationResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSBucketConfiguration *configuration; |
| | | |
| | | /** |
| | | 桶区域 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDictionary *location; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketLocation) |
| | | |
| | | /** |
| | | 获取桶区域 |
| | | |
| | | @param request 获取桶位置request对象 |
| | | @param completionHandler 获取桶区域回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketLocation:(__kindof OBSBaseRequest<OBSGetBucketLocationProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketLocationResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketLocationModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketLoggingModel_h |
| | | #define OBSGetBucketLoggingModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶日志 |
| | | */ |
| | | @protocol OBSGetBucketLoggingProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶日志request |
| | | */ |
| | | @interface OBSGetBucketLoggingRequest: OBSBaseRequest<OBSGetBucketLoggingProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | |
| | | /** |
| | | 初始化获取桶日志request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶日志request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketLoggingRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶日志response |
| | | */ |
| | | @interface OBSGetBucketLoggingResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶日志配置列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLoggingEnabled*> *loggingEnabledList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketLogging) |
| | | |
| | | /** |
| | | 获取桶日志 |
| | | |
| | | @param request 获取桶日志request |
| | | @param completionHandler 获取桶日志回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketLogging:(__kindof OBSBaseRequest<OBSGetBucketLoggingProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketLoggingResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetBucketLoggingModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketMetaDataModel_h |
| | | #define OBSGetBucketMetaDataModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSEncryptionTypeCustomer; |
| | | |
| | | /** |
| | | 获取桶元数据 |
| | | */ |
| | | @protocol OBSGetBucketMetaDataProtocol <NSObject> |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶元数据request |
| | | */ |
| | | @interface OBSGetBucketMetaDataRequest : OBSCORSRequest<OBSGetBucketMetaDataProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶元数据request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶元数据request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingGetBucketMetaDataRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶元数据response |
| | | */ |
| | | @interface OBSGetBucketMetaDataResponse: OBSCORSResponse |
| | | |
| | | /** |
| | | 桶区域位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *region; |
| | | |
| | | /** |
| | | 桶存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass defaultStorageClass; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketMetaData) |
| | | |
| | | /** |
| | | 获取桶元数据 |
| | | |
| | | @param request 获取桶元数据request |
| | | @param completionHandler 获取桶元数据回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketMetaData:(__kindof OBSBaseRequest<OBSGetBucketMetaDataProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketMetaDataResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketMetaDataModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketNotificationModel_h |
| | | #define OBSGetBucketNotificationModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶的消息通知配置 |
| | | */ |
| | | @protocol OBSGetBucketNotificationProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶的消息通知配置request |
| | | */ |
| | | @interface OBSGetBucketNotificationRequest: OBSBaseRequest<OBSGetBucketNotificationProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶的消息通知配置request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶消息通知配置request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketNotificationRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶的消息通知配置response |
| | | */ |
| | | @interface OBSGetBucketNotificationResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶的消息通知配置数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSNotificationTopicConfiguration*> *configurationList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketNotification) |
| | | |
| | | /** |
| | | 获取桶的消息通知配置 |
| | | |
| | | @param request 获取桶的消息通知配置request |
| | | @param completionHandler 获取桶的消息通知配置回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketNotification:(__kindof OBSBaseRequest<OBSGetBucketNotificationProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketNotificationResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetBucketNotificationModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketPolicyModel_h |
| | | #define OBSGetBucketPolicyModel_h |
| | | |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶策略 |
| | | */ |
| | | @protocol OBSGetBucketPolicyProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶策略 |
| | | */ |
| | | @interface OBSGetBucketPolicyRequest: OBSBaseRequest<OBSGetBucketPolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶策略request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketPolicyRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶策略response |
| | | */ |
| | | @interface OBSGetBucketPolicyResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶策略列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSPolicyStatement*> *policyStatementList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketPolicy) |
| | | |
| | | /** |
| | | 获取桶策略 |
| | | |
| | | @param request 获取桶策略request |
| | | @param completionHandler 获取桶策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketPolicy:(__kindof OBSBaseRequest<OBSGetBucketPolicyProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketPolicyResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketPolicyModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketQuotaModel_h |
| | | #define OBSGetBucketQuotaModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶配额 |
| | | */ |
| | | @protocol OBSGetBucketQuotaProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶配额 |
| | | */ |
| | | @interface OBSGetBucketQuotaRequest: OBSBaseRequest<OBSGetBucketQuotaProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶配额request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶配额request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName ; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketQuotaRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶配额response |
| | | */ |
| | | @interface OBSGetBucketQuotaResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶配额 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSQuota *quota; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | |
| | | @interface OBSClient(getBucketQuota) |
| | | |
| | | /** |
| | | 获取桶配额 |
| | | |
| | | @param request 获取桶配额request |
| | | @param completionHandler 获取桶配额request |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketQuota:(__kindof OBSBaseRequest<OBSGetBucketQuotaProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketQuotaResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketQuotaModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketStorageInfoModel_h |
| | | #define OBSGetBucketStorageInfoModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | @class OBSEncryptionTypeCustomer; |
| | | |
| | | |
| | | /** |
| | | 获取桶存量信息 |
| | | */ |
| | | @protocol OBSGetBucketStorageInfoProtocol <NSObject> |
| | | @end |
| | | |
| | | #pragma mark - entity |
| | | |
| | | @interface OBSBucketStorageInfo: OBSBaseEntity |
| | | |
| | | /** |
| | | 存量大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *size; |
| | | |
| | | /** |
| | | 对象个数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *objectNumber; |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶存量信息 |
| | | */ |
| | | @interface OBSGetBucketStorageInfoRequest : OBSBaseRequest<OBSGetBucketStorageInfoProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 获取桶存量信息request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶存量信息request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingGetBucketStorageInfoRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶存量信息response |
| | | */ |
| | | @interface OBSGetBucketStorageInfoResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶存量信息 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSBucketStorageInfo *storageInfo; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketStorageInfo) |
| | | |
| | | /** |
| | | 获取桶存量信息 |
| | | |
| | | @param request 获取桶存量信息request |
| | | @param completionHandler 获取桶存量信息回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketStorageInfo:(__kindof OBSBaseRequest<OBSGetBucketStorageInfoProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketStorageInfoResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | |
| | | #endif /* OBSGetBucketStorageInfoModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketStoragePolicyModel_h |
| | | #define OBSGetBucketStoragePolicyModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - request entity |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶存储策略 |
| | | */ |
| | | @protocol OBSGetBucketStoragePolicyProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶存储策略 |
| | | */ |
| | | @interface OBSGetBucketStoragePolicyRequest: OBSBaseRequest<OBSGetBucketStoragePolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 获取桶存储策略request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶存储策略request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketStoragePolicyRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶存储策略response |
| | | */ |
| | | @interface OBSGetBucketStoragePolicyResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶存储策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSStoragePolicy* storagePolicy; |
| | | @property (nonatomic, strong, nonnull) NSDictionary* storageClass; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketStoragePolicy) |
| | | |
| | | /** |
| | | 获取桶存储策略 |
| | | |
| | | @param request 获取桶存储策略request对象 |
| | | @param completionHandler 获取桶存储策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketStoragePolicy:(__kindof OBSBaseRequest<OBSGetBucketStoragePolicyProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketStoragePolicyResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetBucketStoragePolicyModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketTaggingModel_h |
| | | #define OBSGetBucketTaggingModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取桶标签 |
| | | */ |
| | | @protocol OBSGetBucketTaggingProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶标签request |
| | | */ |
| | | @interface OBSGetBucketTaggingRequest: OBSBaseRequest<OBSGetBucketTaggingProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶标签request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶标签request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketTaggingRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶标签response |
| | | */ |
| | | @interface OBSGetBucketTaggingResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 标签列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSBucketTag*> *tagList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketTagging) |
| | | |
| | | /** |
| | | 获取桶标签 |
| | | |
| | | @param request 获取桶标签request |
| | | @param completionHandler 获取桶标签回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketTagging:(__kindof OBSBaseRequest<OBSGetBucketTaggingProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketTaggingResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | |
| | | #endif /* OBSGetBucketTaggingModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketVersioningModel_h |
| | | #define OBSGetBucketVersioningModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | @protocol OBSGetBucketVersioningProtocol |
| | | @required |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | // 获取桶多版本 |
| | | @interface OBSGetBucketVersioningRequest: OBSBaseRequest<OBSGetBucketVersioningProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 获取桶多版本request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @return request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketVersioningRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶多版本response |
| | | */ |
| | | @interface OBSGetBucketVersioningResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶多版本配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSBucketVersioningConfiguration *configuration; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketVersioning) |
| | | |
| | | /** |
| | | 获取桶多版本 |
| | | |
| | | @param request 获取桶多版本request对象 |
| | | @param completionHandler 获取桶多版本回调 |
| | | @return task |
| | | */ |
| | | - (OBSBFTask*)getBucketVersioning:(__kindof OBSBaseRequest<OBSGetBucketVersioningProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketVersioningResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketVersioningModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetBucketWebsiteModel_h |
| | | #define OBSGetBucketWebsiteModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取网站托管配置 |
| | | */ |
| | | @protocol OBSGetBucketWebsiteProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶静态网站托管配置 |
| | | */ |
| | | @interface OBSGetBucketWebsiteRequest: OBSBaseRequest<OBSGetBucketWebsiteProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 初始化获取桶静态网站托管配置request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取桶静态网站托管配置 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetBucketWebsiteRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶静态网站托管配置response |
| | | */ |
| | | @interface OBSGetBucketWebsiteResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 静态网站托管配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractWebsiteConf *configuration; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getBucketWebsite) |
| | | |
| | | /** |
| | | 获取桶静态网站托管配置 |
| | | |
| | | @param request 获取桶静态网站托管配置request |
| | | @param completionHandler 获取桶静态网站托管配置回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getBucketWebsite:(__kindof OBSBaseRequest<OBSGetBucketWebsiteProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetBucketWebsiteResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSGetBucketWebsiteModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetObjectACLModel_h |
| | | #define OBSGetObjectACLModel_h |
| | | |
| | | #define OBSGetObjectACLModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取对象访问策略 |
| | | */ |
| | | @protocol OBSGetObjectACLProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取对象访问策略request |
| | | */ |
| | | @interface OBSGetObjectACLRequest: OBSBaseRequest<OBSGetObjectACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 初始化获取对象访问策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象key |
| | | @return 获取对象访问策略request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey ; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetObjectACLRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取对象访问策略response |
| | | */ |
| | | @interface OBSGetObjectACLResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 对象访问策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSAccessControlPolicy *accessControlPolicy; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getObjectACL) |
| | | |
| | | /** |
| | | 获取对象访问策略 |
| | | |
| | | @param request 获取对象访问策略 request |
| | | @param completionHandler 获取对象访问策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getObjectACL:(__kindof OBSBaseRequest<OBSGetObjectACLProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetObjectACLResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetObjectACLModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetObjectMetaDataModel_h |
| | | #define OBSGetObjectMetaDataModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSAbstractEncryption; |
| | | |
| | | |
| | | /** |
| | | 获取对象属性 |
| | | */ |
| | | @protocol OBSGetObjectMetaDataProtocol <NSObject> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 获取对象属性request |
| | | */ |
| | | @interface OBSGetObjectMetaDataRequest : OBSCORSRequest<OBSGetObjectMetaDataProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 初始化获取对象属性request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @return 获取对象元数据request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingGetObjectMetaDataRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取对象属性response |
| | | */ |
| | | @interface OBSGetObjectMetaDataResponse: OBSCORSResponse |
| | | |
| | | /** |
| | | 对象etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 对象大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *size; |
| | | |
| | | /** |
| | | 对象过期时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *expiration; |
| | | |
| | | /** |
| | | 重定向网址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 最后修改时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | |
| | | 对象为归档存储类型,并且处于正在取回或已经取回时,表示对象的取回状态 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *restore; |
| | | |
| | | /** |
| | | 对象元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(getObjectMetaData) |
| | | |
| | | /** |
| | | 获取对象属性 |
| | | |
| | | @param request 获取对象属性request |
| | | @param completionHandler 获取对象属性回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getObjectMetaData:(__kindof OBSBaseRequest<OBSGetObjectMetaDataProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetObjectMetaDataResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetObjectMetaDataModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetObjectModel_h |
| | | #define OBSGetObjectModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | @class OBSEncryptionTypeCustomer; |
| | | @class OBSAbstractEncryption; |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 下载对象 |
| | | */ |
| | | @protocol OBSGetObjectProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取对象父类 |
| | | */ |
| | | @interface OBSAbstractGetObjectRequest: OBSCORSRequest<OBSGetObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | //resource parameters |
| | | |
| | | /** |
| | | 版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 重写contentType头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseContentType; |
| | | |
| | | /** |
| | | 重写响应中的contentLanguage头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseContentLanguage; |
| | | |
| | | /** |
| | | 重写响应中的expires头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseExpires; |
| | | |
| | | /** |
| | | 重写响应中的cacheControl头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseCacheControl; |
| | | |
| | | /** |
| | | 重写响应中的contentDisposition 头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseContentDisposition; |
| | | |
| | | /** |
| | | 重写响应中的contentEncoding头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *responseContentEncoding; |
| | | |
| | | //header parameters |
| | | |
| | | /** |
| | | 获取在range范围内的对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *range; |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifModifiedSince; |
| | | |
| | | /** |
| | | 如果对象在请求中指定的时间之后没有修改,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *ifUnmodifiedSince; |
| | | |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定的eTag相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagMatch; |
| | | |
| | | /** |
| | | 如果对象的eTag和请求中指定eTag不相同,则返回对象内容 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ifETagNoneMatch; |
| | | //image process |
| | | @property (nonatomic, strong, nonnull) NSString *imageProcess; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | |
| | | /** |
| | | 下载block |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingDownloadProgressBlock downloadProgressBlock; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 流式下载对象request |
| | | */ |
| | | @interface OBSGetObjectToDataRequest: OBSAbstractGetObjectRequest |
| | | |
| | | /** |
| | | 流式下载对象回调 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingOnReceiveDataBlock onReceiveDataBlock; |
| | | |
| | | /** |
| | | 初始化流式下载对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象的key |
| | | @return 流式下载对象request |
| | | */ |
| | | |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 文件方式下载对象request |
| | | */ |
| | | @interface OBSGetObjectToFileRequest: OBSAbstractGetObjectRequest |
| | | |
| | | /** |
| | | 文件存储路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *downloadFilePath; |
| | | |
| | | /** |
| | | 是否后台下载 |
| | | */ |
| | | @property (nonatomic, assign) BOOL background; |
| | | |
| | | /** |
| | | 初始化文件方式下载对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象key |
| | | @param downloadFilePath 文件存储路径 |
| | | @return 文件方式下载对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey downloadFilePath:(NSString*) downloadFilePath; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetObjectToDataRequestNetworking : OBSServiceNetworkingDownloadDataRequest |
| | | @end |
| | | @interface OBSGetObjectToFileRequestNetworking : OBSServiceNetworkingDownloadFileRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 下载对象response |
| | | */ |
| | | @interface OBSGetObjectResponse:OBSCORSResponse |
| | | |
| | | /** |
| | | 对象etag值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 如果对象配置了过期时间,则会返回过期时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *expiration; |
| | | |
| | | /** |
| | | 对象最后修改时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | |
| | | /** |
| | | 当桶设置了website配置,就可以设置对象元数据的这个属性,website接入点返回重定向响应,将请求重定向到该属性指定的桶内的另一个对象或外部的URL。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 标识对象是否是删除标记 |
| | | */ |
| | | @property (nonatomic, assign) BOOL deleteMarker; |
| | | |
| | | /** |
| | | 对象的版本号。如果该对象无版本号,则响应中不会出现 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象自定义元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 对象数据 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSData *objectData; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(getObject) |
| | | |
| | | /** |
| | | 获取对象 |
| | | |
| | | @param request 下载对象request |
| | | @param completionHandler 下载对象的回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)getObject:(__kindof OBSBaseRequest<OBSGetObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSGetObjectModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSGetReplicateBucketModel_h |
| | | #define OBSGetReplicateBucketModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | //request |
| | | #pragma mark - request entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | 获取桶的跨域复制 |
| | | */ |
| | | @protocol OBSGetReplicateBucketProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 获取桶跨域复制request |
| | | */ |
| | | @interface OBSGetReplicateBucketRequest: OBSBaseRequest<OBSGetReplicateBucketProtocol> |
| | | |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | 初始化跨域复制桶的request |
| | | |
| | | @param bucketName 桶名 |
| | | |
| | | @return 跨域复制桶的request |
| | | */ |
| | | |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSGetReplicateBucketRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 获取桶的跨域复制response |
| | | */ |
| | | @interface OBSGetReplicateBucketResponse: OBSServiceResponse |
| | | |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSReplicateBucketRule*> *replicateConfiguration; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(getReplicateBucket) |
| | | |
| | | /** |
| | | 获取桶的跨域复制 |
| | | |
| | | @param request 获取桶的跨域复制request对象 |
| | | @param completionHandler 获取桶的跨域复制的回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)getReplicateBucket:(__kindof OBSBaseRequest<OBSGetReplicateBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSGetReplicateBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceBaseModel_h */ |
New file |
| | |
| | | // |
| | | // OBSInitiateMultipartUploadModel.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 01/12/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSInitiateMultipartUploadModel_h |
| | | #define OBSInitiateMultipartUploadModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 初始化多段上传任务 |
| | | */ |
| | | @protocol OBSInitiateMultipartUploadProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象访问策略 |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 对象重定向 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | /** |
| | | 初始化多段上传任务request |
| | | */ |
| | | @interface OBSInitiateMultipartUploadRequest : OBSBaseRequest<OBSInitiateMultipartUploadProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象ACL |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 存储模式 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 重定向网址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nullable) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | |
| | | /** |
| | | 自定义MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *customContentType; |
| | | |
| | | /** |
| | | 最终映射MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *finalContentType; |
| | | |
| | | /** |
| | | 初始化多段上传任务request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @return 初始化多段上传任务request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingInitiateMultipartUploadRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 初始化多段上传任务response |
| | | */ |
| | | @interface OBSInitiateMultipartUploadResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(initiateMultipartUpload) |
| | | |
| | | /** |
| | | 初始化多段上传任务 |
| | | |
| | | @param request 初始化多段上传任务request |
| | | @param completionHandler 初始化多段上传任务回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)initiateMultipartUpload:(__kindof OBSBaseRequest<OBSInitiateMultipartUploadProtocol>*)request |
| | | completionHandler:(void (^)(OBSInitiateMultipartUploadResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSInitiateMultipartUploadModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSListBucketsModel_h |
| | | #define OBSListBucketsModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | |
| | | |
| | | |
| | | #pragma mark - ListBuckets |
| | | |
| | | //request |
| | | #pragma mark - request |
| | | @protocol OBSListBucketsProtocol<NSObject> |
| | | @end |
| | | |
| | | // 桶列表类 |
| | | @interface OBSListBucketsRequest: OBSBaseRequest<OBSListBucketsProtocol> |
| | | /** |
| | | 是否返回桶的区域信息 |
| | | */ |
| | | @property (nonatomic, assign) NSString *isQueryLocation; |
| | | |
| | | @end |
| | | |
| | | //networking request |
| | | #pragma mark - networking request |
| | | @interface OBSListBucketsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | @interface OBSListBucketsAdditionalProcessor : NSObject<OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | @interface OBSBucket:OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *name; |
| | | @property (nonatomic, strong,nonnull) NSString *location; |
| | | @property (nonatomic, strong, nonnull) NSDate *creationDate; |
| | | @end |
| | | |
| | | @interface OBSListBucketsResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 用户信息,包含用户DomainId和用户名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | |
| | | /** |
| | | 返回桶列表数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSBucket*> *bucketsList; |
| | | @end |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(listBuckets) |
| | | |
| | | /** |
| | | 列举桶 |
| | | |
| | | @param request 列举桶列表request |
| | | @param completionHandler 列举桶列表回调 |
| | | @return OBSBFTask对象 |
| | | */ |
| | | - (OBSBFTask*)listBuckets:(__kindof OBSBaseRequest<OBSListBucketsProtocol>*)request |
| | | completionHandler:(void (^)(OBSListBucketsResponse * , NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSListBucketsModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSListMultipartUploadsModel_h |
| | | #define OBSListMultipartUploadsModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | @interface OBSUpload: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | @property (nonatomic, strong, nonnull) OBSUser *initiator; |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | @property (nonatomic, strong, nonnull) NSDate *initiatedTime; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 列举多段上传任务 |
| | | */ |
| | | @protocol OBSListMultipartUploadsProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 分组标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 响应对象名以prefix开始的任务信息 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举最大的上传任务数目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxUploads; |
| | | |
| | | /** |
| | | 列举指定的keyMarker之后的多段任务 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 只有和keyMarker一起使用才有意义,列举时返回指定的keyMarker的uploadIDMarker之后的多段任务 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadIDMarker; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 列举多段上传任务request |
| | | */ |
| | | @interface OBSListMultipartUploadsRequest: OBSBaseRequest<OBSListMultipartUploadsProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 分组标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 响应对象名以prefix开始的任务信息 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举的多段任务的最大条目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxUploads; |
| | | |
| | | /** |
| | | 列举指定的keyMarker之后的多段任务 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 只有和keyMarker一起使用才有意义,列举时返回指定的keyMarker的uploadIDMarker之后的多段任务 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadIDMarker; |
| | | |
| | | /** |
| | | 初始化列举多段上传任务request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 列举多段上传任务 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSListMultipartUploadsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 列举多段上传任务response |
| | | */ |
| | | @interface OBSListMultipartUploadsResponse: OBSBaseResponse |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 列举时的起始对象位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 列举时的起始uploadID位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadIDMarker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求中将包含nextKeyMarker字段,用于标明接下来请求的keyMarker值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *nextKeyMarker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求中将 包含nextUploadIDMarker字段,用于标明接下来请求的uploadMarker值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *nextUploadIDMarker; |
| | | |
| | | /** |
| | | 返回的最大多段上传任务数目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxUploads; |
| | | |
| | | /** |
| | | 表明是否本次返回的multipartUpload结果列表被截断。“YES”表示本次没有返回全部结果;“NO”表示本次已经返回了全部结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL isTruncated; |
| | | |
| | | /** |
| | | 多段上传任务列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSUpload*> *uploadsList; |
| | | |
| | | /** |
| | | 请求中带的prefix |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 请求中带的delimiter |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 请求中带delimiter参数时,返回消息带commonPrefixes分组信息 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *commonPrefixesList; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(listMultipartUploads) |
| | | |
| | | /** |
| | | 列举多段上传任务 |
| | | |
| | | @param request 列举多段上传任务request |
| | | @param completionHandler 列举多段上传任务回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)listMultipartUploads:(__kindof OBSBaseRequest<OBSListMultipartUploadsProtocol>*)request |
| | | completionHandler:(void (^)(OBSListMultipartUploadsResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSListMultipartUploadsModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSListObjectsModel_h |
| | | #define OBSListObjectsModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | @interface OBSContent : OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | @property (nonatomic, strong, nonnull) NSNumber *size; |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | @end |
| | | |
| | | |
| | | |
| | | @interface OBSCommonPrefix : OBSBaseEntity |
| | | @property (nonatomic,strong) NSString *prefix; |
| | | @end |
| | | |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 列举桶对象 |
| | | */ |
| | | @protocol OBSListObjectsProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 列举以指定的字符串prefix开头的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举桶内对象列表时,指定一个标识符,返回的对象列表将是按照字典顺序排序后,这个标识符以后的所有对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *marker; |
| | | |
| | | /** |
| | | 最大返回对象数目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 用来分组桶内对象的字符串。所有名字包含指定的前缀且第一次出现的object作为一组元素commonPrefixes |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *origin; |
| | | |
| | | /** |
| | | 允许访问的请求类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlRequestHeadersList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 列举桶对象request |
| | | */ |
| | | @interface OBSListObjectsRequest: OBSCORSRequest<OBSListObjectsProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | |
| | | /** |
| | | 列举以指定的字符串prefix开头的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举桶内对象列表时,指定一个标识符,返回的对象列表将是按照字典顺序排序后,这个标识符以后的所有对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *marker; |
| | | |
| | | /** |
| | | 指定返回的最大对象数范围[1,1000],超出按照1000处理 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 用来分组桶内对象的字符串。所有名字包含指定的前缀 且第一次出现的object作为一组元素commonPrefixes |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 与响应中的keyMarker配合使用,返回的对象列表将是按照字典顺序排序后在该标识符以后的所有对象。如果versionIDMarker不是keyMarker的一个版本号,则该参数无效。 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | |
| | | /** |
| | | 初始化列举桶内对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 列举桶内对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSListObjectsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 列举桶对象response |
| | | */ |
| | | @interface OBSListObjectsResponse: OBSCORSResponse |
| | | |
| | | /** |
| | | 桶区域位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *region; |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名的前缀,表示本次请求只列举对象名能匹配该前缀的所有对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举对象时的起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *marker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求 中将包含此字段,用于标明本次请求列 举到的最后一个对象。后续请求可以指 定Marker等于该值来列举剩余的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *nextMarker; |
| | | |
| | | /** |
| | | 列举时最多返回的对象个数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 请求中携带的delimiter参数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 表明是否本次返回的listBucketResult结果列表被截断。“YES”表示本次没有返回全部结果;“NO”表示本次已经返回了全部结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL isTruncated; |
| | | |
| | | /** |
| | | 桶中对象列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSContent*> *contentsList; |
| | | |
| | | /** |
| | | 公共头 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSCommonPrefix*> *commonPrefixesList; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(listObjects) |
| | | - (OBSBFTask*)listObjects:(__kindof OBSBaseRequest<OBSListObjectsProtocol>*)request |
| | | completionHandler:(void (^)(OBSListObjectsResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSListObjectsModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSListObjectsVersionsModel_h |
| | | #define OBSListObjectsVersionsModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | @interface OBSObjectVersion: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @property (nonatomic, assign) BOOL isLatest; |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | @property (nonatomic, strong, nonnull) NSNumber *size; |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | @end |
| | | |
| | | @interface OBSDeleteMarker: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @property (nonatomic, assign) BOOL isLatest; |
| | | @property (nonatomic, strong, nonnull) NSDate *lastModified; |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 列举多版本对象 |
| | | */ |
| | | @protocol OBSListObjectsVersionsProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 列举以指定的字符串prefix开头的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举对象时的起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 列举时最多返回的对象个数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 用来分组桶内对象的字符串 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 列举对象时的起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionIDMarker; |
| | | |
| | | /** |
| | | |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *origin; |
| | | |
| | | /** |
| | | 允许访问的请求种类 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlRequestHeadersList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 列举多版本对象 |
| | | */ |
| | | @interface OBSListObjectsVersionsRequest: OBSCORSRequest<OBSListObjectsVersionsProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 列举以指定的字符串prefix开头的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举标识符以后的对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 指定返回的最大对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 分组桶内的字符串 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 与响应中的keyarker配合使用,返回的对象列表将是按照字典顺序排序后在该标识符以后的所有对象。如果versiondIDMaker不是keyMarker的一个版本号,则该参数 无效 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionIDMarker; |
| | | |
| | | /** |
| | | 初始化获取多版本对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 获取多版本对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSListObjectsVersionsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 列举多版本对象response |
| | | */ |
| | | @interface OBSListObjectsVersionsResponse: OBSCORSResponse |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名的前缀,表示本次请求只列举对象名能匹配该前缀的所有对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 列举对象时的起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyMarker; |
| | | |
| | | /** |
| | | 列举对象时的起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionIDMarker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求中将包含该元素,用于标明接下来请求的KeyMarker值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *nextKeyMarker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求中将包含该元素,用于标明接下来请求的KeyMarker值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *nextVersionIDMarker; |
| | | |
| | | /** |
| | | 列举时最多返回的对象个数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxKeys; |
| | | |
| | | /** |
| | | 请求中携带的delimiter参数 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *delimiter; |
| | | |
| | | /** |
| | | 表明是否本次返回的ListVersionsResult结 果列表被截断。“true”表示本次没有返 回全部结果;“false”表示本次已经返 回了全部结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL isTruncated; |
| | | |
| | | /** |
| | | 保存列举桶中对象列表(含多版本)请求结果的容器 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSObjectVersion*> *versionList; |
| | | |
| | | /** |
| | | 删除标记的数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSDeleteMarker*> *deleteMarkerList; |
| | | |
| | | /** |
| | | 对象名的前缀数组,表示本次请求只列举对象名能匹配该前缀的所有对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> * commonPrefixesList; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(listObjectsVerions) |
| | | |
| | | /** |
| | | 列举多版本对象 |
| | | |
| | | @param request 列举多版本对象request |
| | | @param completionHandler 列举多版本对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)listObjectsVersions:(__kindof OBSBaseRequest<OBSListObjectsVersionsProtocol>*)request |
| | | completionHandler:(void (^)(OBSListObjectsVersionsResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSListObjectsVersionsModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSListPartsModel_h |
| | | #define OBSListPartsModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 列举段 |
| | | */ |
| | | @protocol OBSListPartsProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 最大列举数目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxParts; |
| | | |
| | | /** |
| | | 段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumberMarker; |
| | | @end |
| | | |
| | | /** |
| | | 列举段request |
| | | */ |
| | | @interface OBSListPartsRequest: OBSBaseRequest<OBSListPartsProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 最大段 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxParts; |
| | | |
| | | /** |
| | | 段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumberMarker; |
| | | |
| | | /** |
| | | 初始化列举段request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @param uploadID 多段上传任务ID |
| | | @return 列举段request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectKey:(NSString*) objectKey |
| | | uploadID:(NSString*) uploadID; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSListPartsRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 列举段response |
| | | */ |
| | | @interface OBSListPartsResponse: OBSCORSResponse |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | upload任务的创建者 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSUser *initiator; |
| | | |
| | | /** |
| | | 和initiator相同 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 本次List结果的partNumber起始位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumberMarker; |
| | | |
| | | /** |
| | | 如果本次没有返回全部结果,响应请求中将包含nextPartNumberMarker元素,用于标明接下来请求的 partNumberMarker值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *nextPartNumberMarker; |
| | | |
| | | /** |
| | | 返回请求中最大的part数目 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxParts; |
| | | |
| | | /** |
| | | 标明是否本次返回的listPart结果列表被截断。“true”表示 本次没有返回全部结果;“false”表示本次已经返回了全部结果 |
| | | */ |
| | | @property (nonatomic, assign) BOOL isTruncated; |
| | | |
| | | /** |
| | | 已经上传段的数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<OBSPart*> *partsList; |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(listParts) |
| | | |
| | | /** |
| | | 列举段 |
| | | |
| | | @param request 列举段request |
| | | @param completionHandler 列举段回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)listParts:(__kindof OBSBaseRequest<OBSListPartsProtocol>*)request |
| | | completionHandler:(void (^)(OBSListPartsResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSListPartsModel_h */ |
New file |
| | |
| | | // |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSLogging_h |
| | | #define OBSLogging_h |
| | | |
| | | #import "OBSCocoaLumberjack.h" |
| | | FOUNDATION_EXPORT OBSDDLogLevel obsddLogLevel; |
| | | #define OBSLogError(frmt, ...) OBSLOG_MAYBE(NO, OBSLOG_LEVEL_DEF, OBSDDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
| | | #define OBSLogWarn(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
| | | #define OBSLogInfo(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
| | | #define OBSLogDebug(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
| | | #define OBSLogVerbose(frmt, ...) OBSLOG_MAYBE(OBSLOG_ASYNC_ENABLED, OBSLOG_LEVEL_DEF, OBSDDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) |
| | | |
| | | |
| | | #endif /* OBSLogging_h */ |
New file |
| | |
| | | //
|
| | | // OBSMTLJSONAdapter.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2013-02-12.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | @protocol OBSMTLModel;
|
| | | @protocol OBSMTLTransformerErrorHandling;
|
| | |
|
| | | /// A OBSMTLModel object that supports being parsed from and serialized to JSON.
|
| | | @protocol OBSMTLJSONSerializing <OBSMTLModel>
|
| | | @required
|
| | |
|
| | | /// Specifies how to map property keys to different key paths in JSON.
|
| | | ///
|
| | | /// Subclasses overriding this method should combine their values with those of
|
| | | /// `super`.
|
| | | ///
|
| | | /// Values in the dictionary can either be key paths in the JSON representation
|
| | | /// of the receiver or an array of such key paths. If an array is used, the
|
| | | /// deserialized value will be a dictionary containing all of the keys in the
|
| | | /// array.
|
| | | ///
|
| | | /// Any keys omitted will not participate in JSON serialization.
|
| | | ///
|
| | | /// Examples
|
| | | ///
|
| | | /// + (NSDictionary *)JSONKeyPathsByPropertyKey {
|
| | | /// return @{
|
| | | /// @"name": @"POI.name",
|
| | | /// @"point": @[ @"latitude", @"longitude" ],
|
| | | /// @"starred": @"starred"
|
| | | /// };
|
| | | /// }
|
| | | ///
|
| | | /// This will map the `starred` property to `JSONDictionary[@"starred"]`, `name`
|
| | | /// to `JSONDictionary[@"POI"][@"name"]` and `point` to a dictionary equivalent
|
| | | /// to:
|
| | | ///
|
| | | /// @{
|
| | | /// @"latitude": JSONDictionary[@"latitude"],
|
| | | /// @"longitude": JSONDictionary[@"longitude"]
|
| | | /// }
|
| | | ///
|
| | | /// Returns a dictionary mapping property keys to one or multiple JSON key paths
|
| | | /// (as strings or arrays of strings).
|
| | | + (NSDictionary *)JSONKeyPathsByPropertyKey;
|
| | |
|
| | | @optional
|
| | |
|
| | | /// Specifies how to convert a JSON value to the given property key. If
|
| | | /// reversible, the transformer will also be used to convert the property value
|
| | | /// back to JSON.
|
| | | ///
|
| | | /// If the receiver implements a `+<key>JSONTransformer` method, OBSMTLJSONAdapter
|
| | | /// will use the result of that method instead.
|
| | | ///
|
| | | /// Returns a value transformer, or nil if no transformation should be performed.
|
| | | + (NSValueTransformer *)JSONTransformerForKey:(NSString *)key;
|
| | |
|
| | | /// Overridden to parse the receiver as a different class, based on information
|
| | | /// in the provided dictionary.
|
| | | ///
|
| | | /// This is mostly useful for class clusters, where the abstract base class would
|
| | | /// be passed into -[OBSMTLJSONAdapter initWithJSONDictionary:modelClass:], but
|
| | | /// a subclass should be instantiated instead.
|
| | | ///
|
| | | /// JSONDictionary - The JSON dictionary that will be parsed.
|
| | | ///
|
| | | /// Returns the class that should be parsed (which may be the receiver), or nil
|
| | | /// to abort parsing (e.g., if the data is invalid).
|
| | | + (Class)classForParsingJSONDictionary:(NSDictionary *)JSONDictionary;
|
| | |
|
| | | @end
|
| | |
|
| | | /// The domain for errors originating from OBSMTLJSONAdapter.
|
| | | extern NSString *const OBSMTLJSONAdapterErrorDomain;
|
| | |
|
| | | /// +classForParsingJSONDictionary: returned nil for the given dictionary.
|
| | | extern const NSInteger OBSMTLJSONAdapterErrorNoClassFound;
|
| | |
|
| | | /// The provided JSONDictionary is not valid.
|
| | | extern const NSInteger OBSMTLJSONAdapterErrorInvalidJSONDictionary;
|
| | |
|
| | | /// The model's implementation of +JSONKeyPathsByPropertyKey included a key which
|
| | | /// does not actually exist in +propertyKeys.
|
| | | extern const NSInteger OBSMTLJSONAdapterErrorInvalidJSONMapping;
|
| | |
|
| | | /// An exception was thrown and caught.
|
| | | extern const NSInteger OBSMTLJSONAdapterErrorExceptionThrown;
|
| | |
|
| | | /// Associated with the NSException that was caught.
|
| | | extern NSString *const OBSMTLJSONAdapterThrownExceptionErrorKey;
|
| | |
|
| | | /// Converts a OBSMTLModel object to and from a JSON dictionary.
|
| | | @interface OBSMTLJSONAdapter : NSObject
|
| | |
|
| | | /// Attempts to parse a JSON dictionary into a model object.
|
| | | ///
|
| | | /// modelClass - The OBSMTLModel subclass to attempt to parse from the JSON.
|
| | | /// This class must conform to <OBSMTLJSONSerializing>. This
|
| | | /// argument must not be nil.
|
| | | /// JSONDictionary - A dictionary representing JSON data. This should match the
|
| | | /// format returned by NSJSONSerialization. If this argument is
|
| | | /// nil, the method returns nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// parsing or initializing an instance of `modelClass`.
|
| | | ///
|
| | | /// Returns an instance of `modelClass` upon success, or nil if a parsing error
|
| | | /// occurred.
|
| | | + (id)modelOfClass:(Class)modelClass fromJSONDictionary:(NSDictionary *)JSONDictionary error:(NSError **)error;
|
| | |
|
| | | /// Attempts to parse an array of JSON dictionary objects into a model objects
|
| | | /// of a specific class.
|
| | | ///
|
| | | /// modelClass - The OBSMTLModel subclass to attempt to parse from the JSON. This
|
| | | /// class must conform to <OBSMTLJSONSerializing>. This argument must
|
| | | /// not be nil.
|
| | | /// JSONArray - A array of dictionaries representing JSON data. This should
|
| | | /// match the format returned by NSJSONSerialization. If this
|
| | | /// argument is nil, the method returns nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// parsing or initializing an any of the instances of
|
| | | /// `modelClass`.
|
| | | ///
|
| | | /// Returns an array of `modelClass` instances upon success, or nil if a parsing
|
| | | /// error occurred.
|
| | | + (NSArray *)modelsOfClass:(Class)modelClass fromJSONArray:(NSArray *)JSONArray error:(NSError **)error;
|
| | |
|
| | | /// Converts a model into a JSON representation.
|
| | | ///
|
| | | /// model - The model to use for JSON serialization. This argument must not be
|
| | | /// nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// serializing.
|
| | | ///
|
| | | /// Returns a JSON dictionary, or nil if a serialization error occurred.
|
| | | + (NSDictionary *)JSONDictionaryFromModel:(id<OBSMTLJSONSerializing>)model error:(NSError **)error;
|
| | |
|
| | | /// Converts a array of models into a JSON representation.
|
| | | ///
|
| | | /// models - The array of models to use for JSON serialization. This argument
|
| | | /// must not be nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// serializing.
|
| | | ///
|
| | | /// Returns a JSON array, or nil if a serialization error occurred for any
|
| | | /// model.
|
| | | + (NSArray *)JSONArrayFromModels:(NSArray *)models error:(NSError **)error;
|
| | |
|
| | | /// Initializes the receiver with a given model class.
|
| | | ///
|
| | | /// modelClass - The OBSMTLModel subclass to attempt to parse from the JSON and
|
| | | /// back. This class must conform to <OBSMTLJSONSerializing>. This
|
| | | /// argument must not be nil.
|
| | | ///
|
| | | /// Returns an initialized adapter.
|
| | | - (id)initWithModelClass:(Class)modelClass;
|
| | |
|
| | | /// Deserializes a model from a JSON dictionary.
|
| | | ///
|
| | | /// The adapter will call -validate: on the model and consider it an error if the
|
| | | /// validation fails.
|
| | | ///
|
| | | /// JSONDictionary - A dictionary representing JSON data. This should match the
|
| | | /// format returned by NSJSONSerialization. This argument must
|
| | | /// not be nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// deserializing or validation.
|
| | | ///
|
| | | /// Returns a model object, or nil if a deserialization error occurred or the
|
| | | /// model did not validate successfully.
|
| | | - (id)modelFromJSONDictionary:(NSDictionary *)JSONDictionary error:(NSError **)error;
|
| | |
|
| | | /// Serializes a model into JSON.
|
| | | ///
|
| | | /// model - The model to use for JSON serialization. This argument must not be
|
| | | /// nil.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// serializing.
|
| | | ///
|
| | | /// Returns a model object, or nil if a serialization error occurred.
|
| | | - (NSDictionary *)JSONDictionaryFromModel:(id<OBSMTLJSONSerializing>)model error:(NSError **)error;
|
| | |
|
| | | /// Filters the property keys used to serialize a given model.
|
| | | ///
|
| | | /// propertyKeys - The property keys for which `model` provides a mapping.
|
| | | /// model - The model being serialized.
|
| | | ///
|
| | | /// Subclasses may override this method to determine which property keys should
|
| | | /// be used when serializing `model`. For instance, this method can be used to
|
| | | /// create more efficient updates of server-side resources.
|
| | | ///
|
| | | /// The default implementation simply returns `propertyKeys`.
|
| | | ///
|
| | | /// Returns a subset of propertyKeys that should be serialized for a given
|
| | | /// model.
|
| | | - (NSSet *)serializablePropertyKeys:(NSSet *)propertyKeys forModel:(id<OBSMTLJSONSerializing>)model;
|
| | |
|
| | | /// An optional value transformer that should be used for properties of the given
|
| | | /// class.
|
| | | ///
|
| | | /// A value transformer returned by the model's +JSONTransformerForKey: method
|
| | | /// is given precedence over the one returned by this method.
|
| | | ///
|
| | | /// The default implementation invokes `+<class>JSONTransformer` on the
|
| | | /// receiver if it's implemented. It supports NSURL conversion through
|
| | | /// +NSURLJSONTransformer.
|
| | | ///
|
| | | /// modelClass - The class of the property to serialize. This property must not be
|
| | | /// nil.
|
| | | ///
|
| | | /// Returns a value transformer or nil if no transformation should be used.
|
| | | + (NSValueTransformer *)transformerForModelPropertiesOfClass:(Class)modelClass;
|
| | |
|
| | | /// A value transformer that should be used for a properties of the given
|
| | | /// primitive type.
|
| | | ///
|
| | | /// If `objCType` matches @encode(id), the value transformer returned by
|
| | | /// +transformerForModelPropertiesOfClass: is used instead.
|
| | | ///
|
| | | /// The default implementation transforms properties that match @encode(BOOL)
|
| | | /// using the OBSMTLBooleanValueTransformerName transformer.
|
| | | ///
|
| | | /// objCType - The type encoding for the value of this property. This is the type
|
| | | /// as it would be returned by the @encode() directive.
|
| | | ///
|
| | | /// Returns a value transformer or nil if no transformation should be used.
|
| | | + (NSValueTransformer *)transformerForModelPropertiesOfObjCType:(const char *)objCType;
|
| | |
|
| | | @end
|
| | |
|
| | | @interface OBSMTLJSONAdapter (ValueTransformers)
|
| | |
|
| | | /// Creates a reversible transformer to convert a JSON dictionary into a OBSMTLModel
|
| | | /// object, and vice-versa.
|
| | | ///
|
| | | /// modelClass - The OBSMTLModel subclass to attempt to parse from the JSON. This
|
| | | /// class must conform to <OBSMTLJSONSerializing>. This argument must
|
| | | /// not be nil.
|
| | | ///
|
| | | /// Returns a reversible transformer which uses the class of the receiver for
|
| | | /// transforming values back and forth.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)dictionaryTransformerWithModelClass:(Class)modelClass;
|
| | |
|
| | | /// Creates a reversible transformer to convert an array of JSON dictionaries
|
| | | /// into an array of OBSMTLModel objects, and vice-versa.
|
| | | ///
|
| | | /// modelClass - The OBSMTLModel subclass to attempt to parse from each JSON
|
| | | /// dictionary. This class must conform to <OBSMTLJSONSerializing>.
|
| | | /// This argument must not be nil.
|
| | | ///
|
| | | /// Returns a reversible transformer which uses the class of the receiver for
|
| | | /// transforming array elements back and forth.
|
| | | + (NSValueTransformer<OBSMTLTransformerErrorHandling> *)arrayTransformerWithModelClass:(Class)modelClass;
|
| | |
|
| | | /// This value transformer is used by OBSMTLJSONAdapter to automatically convert
|
| | | /// NSURL properties to JSON strings and vice versa.
|
| | | + (NSValueTransformer *)NSURLJSONTransformer;
|
| | |
|
| | | /// This value transformer is used by OBSMTLJSONAdapter to automatically convert
|
| | | /// NSUUID properties to JSON strings and vice versa.
|
| | | + (NSValueTransformer *)NSUUIDJSONTransformer;
|
| | |
|
| | | @end
|
| | |
|
| | | @class OBSMTLModel;
|
| | |
|
| | | @interface OBSMTLJSONAdapter (Deprecated)
|
| | |
|
| | | @property (nonatomic, strong, readonly) id<OBSMTLJSONSerializing> model __attribute__((unavailable("Replaced by -modelFromJSONDictionary:error:")));
|
| | |
|
| | | + (NSArray *)JSONArrayFromModels:(NSArray *)models __attribute__((deprecated("Replaced by +JSONArrayFromModels:error:"))) NS_SWIFT_UNAVAILABLE("Replaced by +JSONArrayFromModels:error:");
|
| | |
|
| | | + (NSDictionary *)JSONDictionaryFromModel:(OBSMTLModel<OBSMTLJSONSerializing> *)model __attribute__((deprecated("Replaced by +JSONDictionaryFromModel:error:"))) NS_SWIFT_UNAVAILABLE("Replaced by +JSONDictionaryFromModel:error:");
|
| | |
|
| | | - (NSDictionary *)JSONDictionary __attribute__((unavailable("Replaced by -JSONDictionaryFromModel:error:"))) NS_SWIFT_UNAVAILABLE("Replaced by -JSONDictionaryFromModel:error:");
|
| | | - (NSString *)JSONKeyPathForPropertyKey:(NSString *)key __attribute__((unavailable("Replaced by -serializablePropertyKeys:forModel:")));
|
| | | - (id)initWithJSONDictionary:(NSDictionary *)JSONDictionary modelClass:(Class)modelClass error:(NSError **)error __attribute__((unavailable("Replaced by -initWithModelClass:")));
|
| | | - (id)initWithModel:(id<OBSMTLJSONSerializing>)model __attribute__((unavailable("Replaced by -initWithModelClass:"))) NS_SWIFT_UNAVAILABLE("Replaced by -initWithModelClass:");
|
| | | - (NSDictionary *)serializeToJSONDictionary:(NSError **)error __attribute__((unavailable("Replaced by -JSONDictionaryFromModel:error:"))) NS_SWIFT_UNAVAILABLE("Replaced by -JSONDictionaryFromModel:error:");
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // OBSMTLModel+NSCoding.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2013-02-12.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | | #import "OBSMTLModel.h"
|
| | |
|
| | | /// Defines how a OBSMTLModel property key should be encoded into an archive.
|
| | | ///
|
| | | /// OBSMTLModelEncodingBehaviorExcluded - The property should never be encoded.
|
| | | /// OBSMTLModelEncodingBehaviorUnconditional - The property should always be
|
| | | /// encoded.
|
| | | /// OBSMTLModelEncodingBehaviorConditional - The object should be encoded only
|
| | | /// if unconditionally encoded elsewhere.
|
| | | /// This should only be used for object
|
| | | /// properties.
|
| | | typedef enum : NSUInteger {
|
| | | OBSMTLModelEncodingBehaviorExcluded = 0,
|
| | | OBSMTLModelEncodingBehaviorUnconditional,
|
| | | OBSMTLModelEncodingBehaviorConditional,
|
| | | } OBSMTLModelEncodingBehavior;
|
| | |
|
| | | /// Implements default archiving and unarchiving behaviors for OBSMTLModel.
|
| | | @interface OBSMTLModel (NSCoding) <NSCoding>
|
| | |
|
| | | /// Initializes the receiver from an archive.
|
| | | ///
|
| | | /// This will decode the original +modelVersion of the archived object, then
|
| | | /// invoke -decodeValueForKey:withCoder:modelVersion: for each of the receiver's
|
| | | /// +propertyKeys.
|
| | | ///
|
| | | /// Returns an initialized model object, or nil if a decoding error occurred.
|
| | | - (id)initWithCoder:(NSCoder *)coder;
|
| | |
|
| | | /// Archives the receiver using the given coder.
|
| | | ///
|
| | | /// This will encode the receiver's +modelVersion, then the receiver's properties
|
| | | /// according to the behaviors specified in +encodingBehaviorsByPropertyKey.
|
| | | - (void)encodeWithCoder:(NSCoder *)coder;
|
| | |
|
| | | /// Determines how the +propertyKeys of the class are encoded into an archive.
|
| | | /// The values of this dictionary should be boxed OBSMTLModelEncodingBehavior
|
| | | /// values.
|
| | | ///
|
| | | /// Any keys not present in the dictionary will be excluded from the archive.
|
| | | ///
|
| | | /// Subclasses overriding this method should combine their values with those of
|
| | | /// `super`.
|
| | | ///
|
| | | /// Returns a dictionary mapping the receiver's +propertyKeys to default encoding
|
| | | /// behaviors. If a property is an object with `weak` semantics, the default
|
| | | /// behavior is OBSMTLModelEncodingBehaviorConditional; otherwise, the default is
|
| | | /// OBSMTLModelEncodingBehaviorUnconditional.
|
| | | + (NSDictionary *)encodingBehaviorsByPropertyKey;
|
| | |
|
| | | /// Determines the classes that are allowed to be decoded for each of the
|
| | | /// receiver's properties when using <NSSecureCoding>. The values of this
|
| | | /// dictionary should be NSArrays of Class objects.
|
| | | ///
|
| | | /// If any encodable keys (as determined by +encodingBehaviorsByPropertyKey) are
|
| | | /// not present in the dictionary, an exception will be thrown during secure
|
| | | /// encoding or decoding.
|
| | | ///
|
| | | /// Subclasses overriding this method should combine their values with those of
|
| | | /// `super`.
|
| | | ///
|
| | | /// Returns a dictionary mapping the receiver's encodable keys (as determined by
|
| | | /// +encodingBehaviorsByPropertyKey) to default allowed classes, based on the
|
| | | /// type that each property is declared as. If type of an encodable property
|
| | | /// cannot be determined (e.g., it is declared as `id`), it will be omitted from
|
| | | /// the dictionary, and subclasses must provide a valid value to prevent an
|
| | | /// exception being thrown during encoding/decoding.
|
| | | + (NSDictionary *)allowedSecureCodingClassesByPropertyKey;
|
| | |
|
| | | /// Decodes the value of the given property key from an archive.
|
| | | ///
|
| | | /// By default, this method looks for a `-decode<Key>WithCoder:modelVersion:`
|
| | | /// method on the receiver, and invokes it if found.
|
| | | ///
|
| | | /// If the custom method is not implemented and `coder` does not require secure
|
| | | /// coding, `-[NSCoder decodeObjectForKey:]` will be invoked with the given
|
| | | /// `key`.
|
| | | ///
|
| | | /// If the custom method is not implemented and `coder` requires secure coding,
|
| | | /// `-[NSCoder decodeObjectOfClasses:forKey:]` will be invoked with the
|
| | | /// information from +allowedSecureCodingClassesByPropertyKey and the given `key`. The
|
| | | /// receiver must conform to <NSSecureCoding> for this to work correctly.
|
| | | ///
|
| | | /// key - The property key to decode the value for. This argument cannot
|
| | | /// be nil.
|
| | | /// coder - The NSCoder representing the archive being decoded. This
|
| | | /// argument cannot be nil.
|
| | | /// modelVersion - The version of the original model object that was encoded.
|
| | | ///
|
| | | /// Returns the decoded and boxed value, or nil if the key was not present.
|
| | | - (id)decodeValueForKey:(NSString *)key withCoder:(NSCoder *)coder modelVersion:(NSUInteger)modelVersion;
|
| | |
|
| | | /// The version of this OBSMTLModel subclass.
|
| | | ///
|
| | | /// This version number is saved in archives so that later model changes can be
|
| | | /// made backwards-compatible with old versions.
|
| | | ///
|
| | | /// Subclasses should override this method to return a higher version number
|
| | | /// whenever a breaking change is made to the model.
|
| | | ///
|
| | | /// Returns 0.
|
| | | + (NSUInteger)modelVersion;
|
| | |
|
| | | @end
|
| | |
|
| | | /// This method must be overridden to support archives created by older versions
|
| | | /// of Mantle (before the `OBSMTLModel+NSCoding` interface existed).
|
| | | @interface OBSMTLModel (OldArchiveSupport)
|
| | |
|
| | | /// Converts an archived external representation to a dictionary suitable for
|
| | | /// passing to -initWithDictionary:.
|
| | | ///
|
| | | /// externalRepresentation - The decoded external representation of the receiver.
|
| | | /// fromVersion - The model version at the time the external
|
| | | /// representation was encoded.
|
| | | ///
|
| | | /// Returns nil by default, indicating that conversion failed.
|
| | | + (NSDictionary *)dictionaryValueFromArchivedExternalRepresentation:(NSDictionary *)externalRepresentation version:(NSUInteger)fromVersion;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // OBSMTLModel.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2012-09-11.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | /// Defines a property's storage behavior, which affects how it will be copied,
|
| | | /// compared, and persisted.
|
| | | ///
|
| | | /// OBSMTLPropertyStorageNone - This property is not included in -description,
|
| | | /// -hash, or anything else.
|
| | | /// OBSMTLPropertyStorageTransitory - This property is included in one-off
|
| | | /// operations like -copy and -dictionaryValue but
|
| | | /// does not affect -isEqual: or -hash.
|
| | | /// It may disappear at any time.
|
| | | /// OBSMTLPropertyStoragePermanent - The property is included in serialization
|
| | | /// (like `NSCoding`) and equality, since it can
|
| | | /// be expected to stick around.
|
| | | typedef enum : NSUInteger {
|
| | | OBSMTLPropertyStorageNone,
|
| | | OBSMTLPropertyStorageTransitory,
|
| | | OBSMTLPropertyStoragePermanent,
|
| | | } OBSMTLPropertyStorage;
|
| | |
|
| | | /// This protocol defines the minimal interface that classes need to implement to
|
| | | /// interact with Mantle adapters.
|
| | | ///
|
| | | /// It is intended for scenarios where inheriting from OBSMTLModel is not feasible.
|
| | | /// However, clients are encouraged to subclass the OBSMTLModel class if they can.
|
| | | ///
|
| | | /// Clients that wish to implement their own adapters should target classes
|
| | | /// conforming to this protocol rather than subclasses of OBSMTLModel to ensure
|
| | | /// maximum compatibility.
|
| | | @protocol OBSMTLModel <NSObject, NSCopying>
|
| | |
|
| | | /// Initializes a new instance of the receiver using key-value coding, setting
|
| | | /// the keys and values in the given dictionary.
|
| | | ///
|
| | | /// dictionaryValue - Property keys and values to set on the instance. Any NSNull
|
| | | /// values will be converted to nil before being used. KVC
|
| | | /// validation methods will automatically be invoked for all of
|
| | | /// the properties given.
|
| | | /// error - If not NULL, this may be set to any error that occurs
|
| | | /// (like a KVC validation error).
|
| | | ///
|
| | | /// Returns an initialized model object, or nil if validation failed.
|
| | | + (instancetype)modelWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error;
|
| | |
|
| | | /// A dictionary representing the properties of the receiver.
|
| | | ///
|
| | | /// Combines the values corresponding to all +propertyKeys into a dictionary,
|
| | | /// with any nil values represented by NSNull.
|
| | | ///
|
| | | /// This property must never be nil.
|
| | | @property (nonatomic, copy, readonly) NSDictionary *dictionaryValue;
|
| | |
|
| | | /// Initializes the receiver using key-value coding, setting the keys and values
|
| | | /// in the given dictionary.
|
| | | ///
|
| | | /// Subclass implementations may override this method, calling the super
|
| | | /// implementation, in order to perform further processing and initialization
|
| | | /// after deserialization.
|
| | | ///
|
| | | /// dictionaryValue - Property keys and values to set on the receiver. Any NSNull
|
| | | /// values will be converted to nil before being used. KVC
|
| | | /// validation methods will automatically be invoked for all of
|
| | | /// the properties given. If nil, this method is equivalent to
|
| | | /// -init.
|
| | | /// error - If not NULL, this may be set to any error that occurs
|
| | | /// (like a KVC validation error).
|
| | | ///
|
| | | /// Returns an initialized model object, or nil if validation failed.
|
| | | - (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error;
|
| | |
|
| | | /// Merges the value of the given key on the receiver with the value of the same
|
| | | /// key from the given model object, giving precedence to the other model object.
|
| | | - (void)mergeValueForKey:(NSString *)key fromModel:(id<OBSMTLModel>)model;
|
| | |
|
| | | /// Returns the keys for all @property declarations, except for `readonly`
|
| | | /// properties without ivars, or properties on OBSMTLModel itself.
|
| | | + (NSSet *)propertyKeys;
|
| | |
|
| | | /// Validates the model.
|
| | | ///
|
| | | /// error - If not NULL, this may be set to any error that occurs during
|
| | | /// validation
|
| | | ///
|
| | | /// Returns YES if the model is valid, or NO if the validation failed.
|
| | | - (BOOL)validate:(NSError **)error;
|
| | |
|
| | | @end
|
| | |
|
| | | /// An abstract base class for model objects, using reflection to provide
|
| | | /// sensible default behaviors.
|
| | | ///
|
| | | /// The default implementations of <NSCopying>, -hash, and -isEqual: make use of
|
| | | /// the +propertyKeys method.
|
| | | @interface OBSMTLModel : NSObject <OBSMTLModel>
|
| | |
|
| | | /// Initializes the receiver using key-value coding, setting the keys and values
|
| | | /// in the given dictionary.
|
| | | ///
|
| | | /// dictionaryValue - Property keys and values to set on the receiver. Any NSNull
|
| | | /// values will be converted to nil before being used. KVC
|
| | | /// validation methods will automatically be invoked for all of
|
| | | /// the properties given. If nil, this method is equivalent to
|
| | | /// -init.
|
| | | /// error - If not NULL, this may be set to any error that occurs
|
| | | /// (like a KVC validation error).
|
| | | ///
|
| | | /// Returns an initialized model object, or nil if validation failed.
|
| | | - (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error;
|
| | |
|
| | | /// Initializes the receiver with default values.
|
| | | ///
|
| | | /// This is the designated initializer for this class.
|
| | | - (instancetype)init;
|
| | |
|
| | | /// By default, this method looks for a `-merge<Key>FromModel:` method on the
|
| | | /// receiver, and invokes it if found. If not found, and `model` is not nil, the
|
| | | /// value for the given key is taken from `model`.
|
| | | - (void)mergeValueForKey:(NSString *)key fromModel:(id<OBSMTLModel>)model;
|
| | |
|
| | | /// Merges the values of the given model object into the receiver, using
|
| | | /// -mergeValueForKey:fromModel: for each key in +propertyKeys.
|
| | | ///
|
| | | /// `model` must be an instance of the receiver's class or a subclass thereof.
|
| | | - (void)mergeValuesForKeysFromModel:(id<OBSMTLModel>)model;
|
| | |
|
| | | /// The storage behavior of a given key.
|
| | | ///
|
| | | /// The default implementation returns OBSMTLPropertyStorageNone for properties that
|
| | | /// are readonly and not backed by an instance variable and
|
| | | /// OBSMTLPropertyStoragePermanent otherwise.
|
| | | ///
|
| | | /// Subclasses can use this method to prevent OBSMTLModel from resolving circular
|
| | | /// references by returning OBSMTLPropertyStorageTransitory.
|
| | | ///
|
| | | /// Returns the storage behavior for a given key on the receiver.
|
| | | + (OBSMTLPropertyStorage)storageBehaviorForPropertyWithKey:(NSString *)propertyKey;
|
| | |
|
| | | /// Compares the receiver with another object for equality.
|
| | | ///
|
| | | /// The default implementation is equivalent to comparing all properties of both
|
| | | /// models for which +storageBehaviorForPropertyWithKey: returns
|
| | | /// OBSMTLPropertyStoragePermanent.
|
| | | ///
|
| | | /// Returns YES if the two models are considered equal, NO otherwise.
|
| | | - (BOOL)isEqual:(id)object;
|
| | |
|
| | | /// A string that describes the contents of the receiver.
|
| | | ///
|
| | | /// The default implementation is based on the receiver's class and all its
|
| | | /// properties for which +storageBehaviorForPropertyWithKey: returns
|
| | | /// OBSMTLPropertyStoragePermanent.
|
| | | - (NSString *)description;
|
| | |
|
| | | @end
|
| | |
|
| | | /// Implements validation logic for OBSMTLModel.
|
| | | @interface OBSMTLModel (Validation)
|
| | |
|
| | | /// Validates the model.
|
| | | ///
|
| | | /// The default implementation simply invokes -validateValue:forKey:error: with
|
| | | /// all +propertyKeys and their current value. If -validateValue:forKey:error:
|
| | | /// returns a new value, the property is set to that new value.
|
| | | ///
|
| | | /// error - If not NULL, this may be set to any error that occurs during
|
| | | /// validation
|
| | | ///
|
| | | /// Returns YES if the model is valid, or NO if the validation failed.
|
| | | - (BOOL)validate:(NSError **)error;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // OBSMTLReflection.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2013-03-12.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | /// Creates a selector from a key and a constant string.
|
| | | ///
|
| | | /// key - The key to insert into the generated selector. This key should be in
|
| | | /// its natural case.
|
| | | /// suffix - A string to append to the key as part of the selector.
|
| | | ///
|
| | | /// Returns a selector, or NULL if the input strings cannot form a valid
|
| | | /// selector.
|
| | | SEL OBSMTLSelectorWithKeyPattern(NSString *key, const char *suffix) __attribute__((pure, nonnull(1, 2)));
|
| | |
|
| | | /// Creates a selector from a key and a constant prefix and suffix.
|
| | | ///
|
| | | /// prefix - A string to prepend to the key as part of the selector.
|
| | | /// key - The key to insert into the generated selector. This key should be in
|
| | | /// its natural case, and will have its first letter capitalized when
|
| | | /// inserted.
|
| | | /// suffix - A string to append to the key as part of the selector.
|
| | | ///
|
| | | /// Returns a selector, or NULL if the input strings cannot form a valid
|
| | | /// selector.
|
| | | SEL OBSMTLSelectorWithCapitalizedKeyPattern(const char *prefix, NSString *key, const char *suffix) __attribute__((pure, nonnull(1, 2, 3)));
|
New file |
| | |
| | | //
|
| | | // OBSMTLTransformerErrorHandling.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Robert Böhnke on 10/6/13.
|
| | | // Copyright (c) 2013 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | /// The domain for errors originating from the OBSMTLTransformerErrorHandling
|
| | | /// protocol.
|
| | | ///
|
| | | /// Transformers conforming to this protocol are expected to use this error
|
| | | /// domain if the transformation fails.
|
| | | extern NSString *const OBSMTLTransformerErrorHandlingErrorDomain;
|
| | |
|
| | | /// Used to indicate that the input value was illegal.
|
| | | ///
|
| | | /// Transformers conforming to this protocol are expected to use this error code
|
| | | /// if the transformation fails due to an invalid input value.
|
| | | extern const NSInteger OBSMTLTransformerErrorHandlingErrorInvalidInput;
|
| | |
|
| | | /// Associated with the invalid input value.
|
| | | ///
|
| | | /// Transformers conforming to this protocol are expected to associate this key
|
| | | /// with the invalid input in the userInfo dictionary.
|
| | | extern NSString *const OBSMTLTransformerErrorHandlingInputValueErrorKey;
|
| | |
|
| | | /// This protocol can be implemented by NSValueTransformer subclasses to
|
| | | /// communicate errors that occur during transformation.
|
| | | @protocol OBSMTLTransformerErrorHandling <NSObject>
|
| | | @required
|
| | |
|
| | | /// Transforms a value, returning any error that occurred during transformation.
|
| | | ///
|
| | | /// value - The value to transform.
|
| | | /// success - If not NULL, this will be set to a boolean indicating whether the
|
| | | /// transformation was successful.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// transforming the value.
|
| | | ///
|
| | | /// Returns the result of the transformation which may be nil. Clients should
|
| | | /// inspect the success parameter to decide how to proceed with the result.
|
| | | - (id)transformedValue:(id)value success:(BOOL *)success error:(NSError **)error;
|
| | |
|
| | | @optional
|
| | |
|
| | | /// Reverse-transforms a value, returning any error that occurred during
|
| | | /// transformation.
|
| | | ///
|
| | | /// Transformers conforming to this protocol are expected to implemented this
|
| | | /// method if they support reverse transformation.
|
| | | ///
|
| | | /// value - The value to transform.
|
| | | /// success - If not NULL, this will be set to a boolean indicating whether the
|
| | | /// transformation was successful.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// transforming the value.
|
| | | ///
|
| | | /// Returns the result of the reverse transformation which may be nil. Clients
|
| | | /// should inspect the success parameter to decide how to proceed with the
|
| | | /// result.
|
| | | - (id)reverseTransformedValue:(id)value success:(BOOL *)success error:(NSError **)error;
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // OBSMTLValueTransformer.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2012-09-11.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | #import "OBSMTLTransformerErrorHandling.h"
|
| | |
|
| | | /// A block that represents a transformation.
|
| | | ///
|
| | | /// value - The value to transform.
|
| | | /// success - The block must set this parameter to indicate whether the
|
| | | /// transformation was successful.
|
| | | /// OBSMTLValueTransformer will always call this block with *success
|
| | | /// initialized to YES.
|
| | | /// error - If not NULL, this may be set to an error that occurs during
|
| | | /// transforming the value.
|
| | | ///
|
| | | /// Returns the result of the transformation, which may be nil.
|
| | | typedef id (^OBSMTLValueTransformerBlock)(id value, BOOL *success, NSError **error);
|
| | |
|
| | | ///
|
| | | /// A value transformer supporting block-based transformation.
|
| | | ///
|
| | | @interface OBSMTLValueTransformer : NSValueTransformer <OBSMTLTransformerErrorHandling>
|
| | |
|
| | | /// Returns a transformer which transforms values using the given block. Reverse
|
| | | /// transformations will not be allowed.
|
| | | + (instancetype)transformerUsingForwardBlock:(OBSMTLValueTransformerBlock)transformation;
|
| | |
|
| | | /// Returns a transformer which transforms values using the given block, for
|
| | | /// forward or reverse transformations.
|
| | | + (instancetype)transformerUsingReversibleBlock:(OBSMTLValueTransformerBlock)transformation;
|
| | |
|
| | | /// Returns a transformer which transforms values using the given blocks.
|
| | | + (instancetype)transformerUsingForwardBlock:(OBSMTLValueTransformerBlock)forwardTransformation reverseBlock:(OBSMTLValueTransformerBlock)reverseTransformation;
|
| | |
|
| | | @end
|
| | |
|
| | | @interface OBSMTLValueTransformer (Deprecated)
|
| | |
|
| | | + (NSValueTransformer *)transformerWithBlock:(id (^)(id))transformationBlock __attribute__((deprecated("Replaced by +transformerUsingForwardBlock:")));
|
| | |
|
| | | + (NSValueTransformer *)reversibleTransformerWithBlock:(id (^)(id))transformationBlock __attribute__((deprecated("Replaced by +transformerUsingReversibleBlock:")));
|
| | |
|
| | | + (NSValueTransformer *)reversibleTransformerWithForwardBlock:(id (^)(id))forwardBlock reverseBlock:(id (^)(id))reverseBlock __attribute__((deprecated("Replaced by +transformerUsingForwardBlock:reverseBlock:")));
|
| | |
|
| | | @end
|
New file |
| | |
| | | //
|
| | | // Mantle.h
|
| | | // Mantle
|
| | | //
|
| | | // Created by Justin Spahr-Summers on 2012-09-04.
|
| | | // Copyright (c) 2012 GitHub. All rights reserved.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | |
|
| | | //! Project version number for Mantle.
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | | FOUNDATION_EXPORT double OBSMantleVersionNumber;
|
| | |
|
| | | //! Project version string for Mantle.
|
| | | FOUNDATION_EXPORT const unsigned char OBSMantleVersionString[];
|
| | | NS_ASSUME_NONNULL_END
|
| | |
|
| | | #import "OBSMTLJSONAdapter.h"
|
| | | #import "OBSMTLModel.h"
|
| | | #import "OBSMTLModel+NSCoding.h"
|
| | | #import "OBSMTLValueTransformer.h"
|
| | | #import "OBSMTLTransformerErrorHandling.h"
|
| | | #import "NSArray+OBSMTLManipulationAdditions.h"
|
| | | #import "NSDictionary+OBSMTLManipulationAdditions.h"
|
| | | #import "NSDictionary+OBSMTLMappingAdditions.h"
|
| | | #import "NSObject+OBSMTLComparisonAdditions.h"
|
| | | #import "NSValueTransformer+OBSMTLInversionAdditions.h"
|
| | | #import "NSValueTransformer+OBSMTLPredefinedTransformerAdditions.h"
|
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSOptionsBucketModel_h |
| | | #define OBSOptionsBucketModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | /** |
| | | 预请求桶 |
| | | */ |
| | | @protocol OBSOptionsBucketProtocol <NSObject> |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 预请求桶创建request |
| | | */ |
| | | @interface OBSOptionsBucketRequest : OBSBaseRequest<OBSOptionsBucketProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 跨域请求origin(通常为域名) |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *origin; |
| | | |
| | | /** |
| | | HTTP头域列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlRequestHeadersList; |
| | | |
| | | /** |
| | | HTTP方法 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *accessControlRequestMethod; |
| | | |
| | | |
| | | /** |
| | | 初始化创建预请求桶request |
| | | |
| | | @param bucketName 桶名 |
| | | @param origin 域名 |
| | | @param method HTTP方法 |
| | | @return 创建预请求桶request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | origin:(NSString*) origin |
| | | accessControlRequestMethod:(NSString*) method; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingOptionsBucketRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置预请求桶response |
| | | */ |
| | | @interface OBSOptionsBucketResponse: OBSCORSResponse |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(optionsBucket) |
| | | |
| | | /** |
| | | 设置预请求桶 |
| | | |
| | | @param request 设置预请求桶request |
| | | @param completionHandler 设置预请求桶回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)optionsBucket:(__kindof OBSBaseRequest<OBSOptionsBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSOptionsBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | |
| | | #endif /* OBSOptionsBucketModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSOptionsObjectModel_h |
| | | #define OBSOptionsObjectModel_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | /** |
| | | 预请求对象 |
| | | */ |
| | | @protocol OBSOptionsObjectProtocol <NSObject> |
| | | @end |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 预请求对象request |
| | | */ |
| | | @interface OBSOptionsObjectRequest : OBSBaseRequest<OBSOptionsObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 跨域请求域名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *origin; |
| | | |
| | | /** |
| | | 实际请求可以带的HTTP头域 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlRequestHeadersList; |
| | | |
| | | /** |
| | | 实际请求可以带的HTTP方法 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *accessControlRequestMethod; |
| | | |
| | | |
| | | /** |
| | | 初始化预请求对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param key 对象KEY |
| | | @param origin 跨域请求域名 |
| | | @param method 可以带的方法 |
| | | @return 预请求对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectKey:(NSString*) key |
| | | origin:(NSString*) origin |
| | | accessControlRequestMethod:(NSString*) method; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingOptionsObjectRequest : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 预请求对象response |
| | | */ |
| | | @interface OBSOptionsObjectResponse: OBSCORSResponse |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | |
| | | @interface OBSClient(optionsObject) |
| | | |
| | | /** |
| | | 预请求对象 |
| | | |
| | | @param request 预请求对象request |
| | | @param completionHandler 预请求对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)optionsObject:(__kindof OBSBaseRequest<OBSOptionsObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSOptionsObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSOptionsObjectModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSPreSignedURLModel_h |
| | | #define OBSPreSignedURLModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | // 定义协议种类 |
| | | static OBSProtocolType protocolPreSignedURL; |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(preSignedURL) |
| | | |
| | | /** |
| | | 获得V2临时鉴权URL |
| | | |
| | | @param request 所有继承OBSBaseRequest的request对象 |
| | | @param expire 有效时间 |
| | | @param completionHandler 回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)createV2PreSignedURL:(__kindof OBSBaseRequest*)request expireAfter:(long long) expire completionHandler:(void (^)(NSString *urlString, NSString * httpVerb, NSDictionary *signedHeaders))completionHandler; |
| | | /** |
| | | 获得V4临时鉴权URL |
| | | |
| | | @param request 所有继承OBSBaseRequest的request对象 |
| | | @param expire 有效时间 |
| | | @param completionHandler 回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)createV4PreSignedURL:(__kindof OBSBaseRequest*)request expireAfter:(long long) expire completionHandler:(void (^)(NSString *urlString, NSString *httpVerb, NSDictionary *signedHeaders))completionHandler; |
| | | @end |
| | | #endif /* OBSPreSignedURLModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #import <Foundation/Foundation.h> |
| | | #import <os/lock.h> |
| | | #import <CommonCrypto/CommonCrypto.h> |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSBaseModel.h" |
| | | |
| | | |
| | | |
| | | |
| | | @interface OBSProtocol : NSObject |
| | | |
| | | @property(nonatomic,strong)NSLock *nslock0; |
| | | @property(nonatomic,strong)NSLock *nslock1; |
| | | @property(nonatomic,strong)NSLock *nslock2; |
| | | @property(nonatomic,strong)NSLock *nslock3; |
| | | @property(nonatomic,strong)NSLock *nslock4; |
| | | @property(nonatomic,strong)NSLock *nslock5; |
| | | @property(nonatomic,strong)NSLock *nslock6; |
| | | @property(nonatomic,strong)NSLock *nslock7; |
| | | @property(nonatomic,strong)NSLock *nslock8; |
| | | @property(nonatomic,strong)NSLock *nslock9; |
| | | |
| | | // 单例 |
| | | +(OBSProtocol *)sharedOBSProtocol; |
| | | |
| | | //列举桶 |
| | | -(BOOL)getObsProtocolListBucket:(int)times endPoint:(NSURL*)endPoint baseRequest:(OBSBaseRequest *) baseRequest; |
| | | //创建桶 |
| | | -(BOOL)getObsProtocolCreatBucket:(int)times bucketName:(NSString*)bucketName endPoint:(NSURL*)endPoint baseRequest:(OBSBaseRequest *) baseRequest; |
| | | //其他接口 |
| | | -(BOOL)getObsProtocolOthers:(int)times bucketName:(NSString*)bucketName endPoint:(NSURL*)endPoint baseRequest:(OBSBaseRequest *) baseRequest; |
| | | |
| | | |
| | | @end |
New file |
| | |
| | | // |
| | | // OBSPutObjectRequest.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 07/11/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSPutObjectRequest_h |
| | | #define OBSPutObjectRequest_h |
| | | |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | //request |
| | | @class OBSAbstractEncryption; |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 上传对象 |
| | | */ |
| | | @protocol OBSPutObjectProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | MD5值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *contentMD5; |
| | | |
| | | /** |
| | | 对象访问策略 |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 重定向地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传进度 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 上传对象request父类 |
| | | */ |
| | | @interface OBSAbstractPutObjectRequest : OBSBaseRequest<OBSPutObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象描述标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象的MD5 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *contentMD5; |
| | | |
| | | /** |
| | | 对象的ACL |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象元数据字典 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 对象重定向地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象和获取对象元数据的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteRead; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象和获取对象元数据的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteReadAcp; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有获取对象ACL的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteWriteAcp; |
| | | |
| | | /** |
| | | 创建对象时,使用此头域授权domain下所有用户有读对象、获取对象元数据、获取对象ACL、写对象ACL的权限 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *granteFullControl; |
| | | |
| | | /** |
| | | 此参数的值是一个URL,用于指定当此次请求操作成功响应后的重定向的地址 |
| | | 如果此参数值有效且操作成功,响应码为303,location头域由此参数以及桶名、对象名、对象的ETag组成 |
| | | 如果此参数值无效,忽略此参数的作用,响应码为204,location头域为对象地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *actionRedirect; |
| | | |
| | | /** |
| | | 表示上传对象的过期时间,单位是天 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *expires; |
| | | |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | |
| | | /** |
| | | 自定义MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *customContentType; |
| | | |
| | | /** |
| | | 最终映射MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *finalContentType; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传对象时的回调 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 流式上传对象request |
| | | */ |
| | | @interface OBSPutObjectWithDataRequest: OBSAbstractPutObjectRequest |
| | | |
| | | /** |
| | | 上传的数据 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSData *uploadData; |
| | | |
| | | /** |
| | | 初始化流式上传对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象名 |
| | | @param data 需要上传的对象数据 |
| | | @return 流式上传对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadData:(NSData*) data; |
| | | |
| | | /** |
| | | 初始上传网络流对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象名 |
| | | @param dataURL 需要上传的网络流地址 |
| | | @return 上传网络流对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadDataURL:(NSURL*) dataURL; |
| | | @end |
| | | |
| | | /** |
| | | 通过文件上传对象request |
| | | */ |
| | | @interface OBSPutObjectWithFileRequest: OBSAbstractPutObjectRequest |
| | | |
| | | /** |
| | | 文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | @property (nonatomic, assign) BOOL background; |
| | | |
| | | /** |
| | | 初始化通过文件上传对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象描述标识 |
| | | @param uploadFilePath 文件路径 |
| | | @return 通过文件上传对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey: (NSString*) objectKey uploadFilePath:(NSString*) uploadFilePath; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingPutObjectWithDataRequest : OBSServiceNetworkingUploadDataRequest |
| | | @end |
| | | @interface OBSNetworkingPutObjectWithFileRequest : OBSServiceNetworkingUploadFileRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 上传对象响应 |
| | | */ |
| | | @interface OBSPutObjectResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 对象etag值 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 如果桶开启了多版本状态 则返回版本号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 对象存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 对象加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(putObject) |
| | | |
| | | /** |
| | | 上传对象 |
| | | |
| | | @param request 上传对象request |
| | | @param completionHandler 上传对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)putObject:(__kindof OBSBaseRequest<OBSPutObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSPutObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSPutObjectRequest_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSReplicateBucketModel_h |
| | | #define OBSReplicateBucketModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceCredentialProvider.h" |
| | | |
| | | //request |
| | | #pragma mark - request entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | |
| | | |
| | | /** |
| | | 桶的跨域复制 |
| | | */ |
| | | @protocol OBSReplicateBucketProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶的跨域复制request |
| | | */ |
| | | @interface OBSReplicateBucketRequest: OBSBaseRequest<OBSReplicateBucketProtocol> |
| | | |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 跨域复制规则 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSReplicateBucketRule*> *replicateConfiguration; |
| | | |
| | | |
| | | /** |
| | | 初始化设置跨域复制桶的request |
| | | |
| | | @param bucketName 桶名 |
| | | |
| | | @return 跨域复制桶的request |
| | | */ |
| | | |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSReplicateBucketRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 桶的跨域复制response |
| | | */ |
| | | @interface OBSReplicateBucketResponse: OBSServiceResponse |
| | | |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(replicateBucket) |
| | | |
| | | /** |
| | | 设置桶的跨域复制 |
| | | |
| | | @param request 跨域复制桶的request对象 |
| | | @param completionHandler 跨域复制桶的回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)replicateBucket:(__kindof OBSBaseRequest<OBSReplicateBucketProtocol>*)request |
| | | completionHandler:(void (^)(OBSReplicateBucketResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceBaseModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSRestoreObjectModel_h |
| | | #define OBSRestoreObjectModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 取回归档存储对象 |
| | | */ |
| | | @protocol OBSRestoreObjectProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 有效时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *storeDays; |
| | | |
| | | /** |
| | | 取回方式 |
| | | */ |
| | | @property (nonatomic, assign) OBSRestoreTier restoreTier; |
| | | |
| | | |
| | | /** |
| | | 对象 |
| | | */ |
| | | |
| | | @property (nonatomic, strong, nonnull) NSString *restore; |
| | | |
| | | @end |
| | | |
| | | /** |
| | | 取回归档存储对象request |
| | | */ |
| | | @interface OBSRestoreObjectRequest: OBSBaseRequest<OBSRestoreObjectProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象KEY |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 取回对象的保存时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *storeDays; |
| | | |
| | | /** |
| | | 取回方式 |
| | | |
| | | Expedited表示快速取回对象,取回耗时1~5min, |
| | | Standard表示标准取回对象,取回耗时3~5h |
| | | */ |
| | | @property (nonatomic, assign) OBSRestoreTier restoreTier; |
| | | @property (nonatomic, strong, nonnull) NSString *restore; |
| | | |
| | | |
| | | /** |
| | | 初始化取回归档存储对象request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象KEY |
| | | @param storeDays 保存时间 |
| | | @return 取回归档存储对象request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectKey:(NSString*) objectKey |
| | | storeDays:(NSNumber*) storeDays; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSRestoreObjectRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 取回归档存储对象response |
| | | */ |
| | | @interface OBSRestoreObjectResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(restoreObject) |
| | | |
| | | /** |
| | | 取回归档存储对象 |
| | | |
| | | @param request 取回归档存储对象request |
| | | @param completionHandler 取回归档存储对象回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)restoreObject:(__kindof OBSBaseRequest<OBSRestoreObjectProtocol>*)request |
| | | completionHandler:(void (^)(OBSRestoreObjectResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSRestoreObjectModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSServiceBaseModel_h |
| | | #define OBSServiceBaseModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | @class OBSBaseConfiguration; |
| | | @class OBSBaseNetworkingRequest; |
| | | @protocol OBSServiceCredentialProvider; |
| | | |
| | | #pragma mark - configuration |
| | | @interface OBSServiceConfiguration : OBSBaseConfiguration |
| | | |
| | | /** |
| | | 对象存储区域 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *region; |
| | | |
| | | /** |
| | | OBS操作凭证 |
| | | */ |
| | | @property (atomic, strong, nonnull) id<OBSServiceCredentialProvider> credentialProvider; |
| | | |
| | | /** |
| | | 是否使用虚拟主机 |
| | | */ |
| | | @property (nonatomic, assign) BOOL useVirtualhost; |
| | | |
| | | /** |
| | | 是否使用自定义域名 |
| | | */ |
| | | @property (nonatomic, assign) BOOL useCustomDomain; |
| | | |
| | | /** |
| | | 域名访问模式 |
| | | */ |
| | | @property (nonatomic, assign) OBSDomainMode defaultDomainMode; |
| | | |
| | | |
| | | /** |
| | | 初始化服务配置 url初始化 |
| | | |
| | | @param url url |
| | | @param credentialProvider OBS操作凭证 |
| | | @return 服务配置对象 |
| | | */ |
| | | -(instancetype) initWithURL: (NSURL*) url credentialProvider: (id<OBSServiceCredentialProvider>) credentialProvider; |
| | | |
| | | /** |
| | | 初始化服务配置 url字符串 |
| | | |
| | | @param urlString url字符串 |
| | | @param credentialProvider OBS操作凭证 |
| | | @return 服务配置对象 |
| | | */ |
| | | -(instancetype) initWithURLString: (NSString*) urlString credentialProvider: (id<OBSServiceCredentialProvider>) credentialProvider; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - networking request |
| | | |
| | | @interface OBSServiceNetworkingRequest : OBSBaseNetworkingRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | @interface OBSServiceNetworkingCommandRequest : OBSNetworkingCommandRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | @interface OBSServiceNetworkingUploadDataRequest : OBSNetworkingUploadDataRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | @interface OBSServiceNetworkingUploadFileRequest : OBSNetworkingUploadFileRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | @interface OBSServiceNetworkingDownloadFileRequest : OBSNetworkingDownloadFileRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | @interface OBSServiceNetworkingDownloadDataRequest : OBSNetworkingDownloadDataRequest |
| | | @property (nonatomic, assign) BOOL authenticationRequired; |
| | | @property (nonatomic, assign) BOOL calcBodyHash; |
| | | @end |
| | | |
| | | #pragma mark - additional post processors |
| | | @interface OBSFlattenHeadersDictPostProcessor: NSObject<OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSAddingContentMD5HeaderPostProcessor: NSObject<OBSNetworkingRequestPostProcessor> |
| | | @end |
| | | |
| | | @interface OBSCustomMetaHeaderPreProcessor: NSObject<OBSNetworkingResponsePreProcessor> |
| | | @end |
| | | |
| | | #pragma mark - Request |
| | | @interface OBSCORSRequest: OBSBaseRequest |
| | | @property (nonatomic, strong, nonnull) NSString *origin; |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlRequestHeadersList; |
| | | @end |
| | | |
| | | #pragma mark - Response |
| | | |
| | | /** |
| | | OBS服务配置响应 |
| | | */ |
| | | @interface OBSServiceResponse: OBSBaseResponse |
| | | |
| | | /** |
| | | xamzRequestID |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *xRequestID; |
| | | @end |
| | | |
| | | @interface OBSCORSResponse: OBSServiceResponse |
| | | @property (nonatomic, strong, nonnull) NSString *accessControlAllowOrigin; |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlAllowHeadersList; |
| | | @property (nonatomic, strong, nonnull) NSNumber *accessControlMaxAge; |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlAllowMethodsList; |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accessControlExposeHeadersList; |
| | | @property (nonatomic, assign) BOOL accessControlAllowCredentials; |
| | | @end |
| | | |
| | | //config |
| | | #endif /* OBSServiceBaseModel_h */ |
New file |
| | |
| | | // |
| | | // OBSServiceCategory.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 14/11/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSServiceCategory_h |
| | | #define OBSServiceCategory_h |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSMTLValueTransformer; |
| | | |
| | | @interface OBSMTLValueTransformer(obsservice) |
| | | //+(NSValueTransformer*)obs_etagTransformer; |
| | | +(NSValueTransformer*)obs_copyEncryptionTransformer; |
| | | +(NSValueTransformer*)obs_metaDataDictTransformer; |
| | | +(NSValueTransformer*)v2_metaDataDictTransformer; |
| | | +(NSValueTransformer*)obs_arrayStringCommaTransformer; |
| | | |
| | | |
| | | +(NSValueTransformer*)obs_OBSTrueFalseDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSStorageClassDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSContentTypeTransformer; |
| | | +(NSValueTransformer*)obs_OBSACLDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSBucketLifecycleStatusDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSVersioningStatusDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSACLPolicyDictTransformer; |
| | | +(NSValueTransformer*)obs_OBSReplicateStatusTransformer; |
| | | |
| | | @end |
| | | |
| | | @interface NSString (obsservice) |
| | | + (nullable instancetype)obs_initWithOBSACLUserType:(OBSACLUserType) aclUserType; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceCategory_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSServiceRequestCommonEntity_h |
| | | #define OBSServiceRequestCommonEntity_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | #pragma mark encryption |
| | | @interface OBSAbstractEncryption: OBSBaseEntity |
| | | @end |
| | | |
| | | /** |
| | | KMS加密方式 |
| | | */ |
| | | @interface OBSEncryptionTypeKMS: OBSAbstractEncryption |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryption; |
| | | |
| | | /** |
| | | 主秘钥 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *serverSideEncryptionAwsKmsKeyID; |
| | | |
| | | /** |
| | | 初始化KMS加密方式 |
| | | |
| | | @param keyID 主密钥 |
| | | @return KMS加密方式 |
| | | */ |
| | | -(instancetype)initWithKeyID:(NSString*) keyID; |
| | | @end |
| | | |
| | | /** |
| | | SSE-C加密方式 |
| | | */ |
| | | @interface OBSEncryptionTypeCustomer: OBSAbstractEncryption |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerAlgorithm; |
| | | |
| | | /** |
| | | 秘钥 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerKey; |
| | | |
| | | /** |
| | | 秘钥的MD5 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerMD5; |
| | | |
| | | /** |
| | | 初始化SSE加密方式 |
| | | |
| | | @param algorithm 加密算法 |
| | | @param key 秘钥 |
| | | @param keyMD5 秘钥的MD5 |
| | | @return SSE加密方式 |
| | | */ |
| | | -(instancetype)initWithAlgorithm:(NSString*) algorithm key:(NSString*) key keyMD5:(NSString*) keyMD5; |
| | | @end |
| | | |
| | | |
| | | |
| | | #pragma mark ACL |
| | | |
| | | /** |
| | | 桶的访问权限控制 |
| | | */ |
| | | @interface OBSUser: OBSBaseEntity |
| | | |
| | | /** |
| | | 桶拥有者ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | /** |
| | | 显示名字 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *displayName; |
| | | -(instancetype)initWithID:(NSString*) ID; |
| | | @end |
| | | |
| | | @interface OBSAbstractACLGrantee :OBSBaseEntity |
| | | @end |
| | | |
| | | /** |
| | | 被授权用户 |
| | | */ |
| | | @interface OBSGrantee : OBSAbstractACLGrantee |
| | | |
| | | /** |
| | | 被授权用户ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | @end |
| | | @interface OBSACLGranteeUser : OBSAbstractACLGrantee |
| | | |
| | | /** |
| | | 被授权用户ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | /** |
| | | 显示名字 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSString *displayName; |
| | | -(instancetype)initWithID:(NSString*) ID; |
| | | @end |
| | | |
| | | @interface OBSACLGranteeAuthenciatedUsers: OBSAbstractACLGrantee |
| | | @end |
| | | |
| | | @interface OBSACLGranteeAllUsers: OBSAbstractACLGrantee |
| | | @end |
| | | |
| | | |
| | | //桶日志设置 |
| | | @interface OBSACLGranteeLogDelivery: OBSAbstractACLGrantee |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 授权用户及权限 |
| | | */ |
| | | @interface OBSACLGrant: OBSBaseEntity |
| | | |
| | | /** |
| | | 授权用户对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractACLGrantee *grantee; |
| | | |
| | | |
| | | |
| | | /** |
| | | 授予的权限 |
| | | |
| | | OBSACLRead 读权限, |
| | | OBSACLWrite 写权限, |
| | | OBSACLRead_ACP 读ACP权限, |
| | | OBSACLWrite_ACP 写ACP权限, |
| | | OBSACLFull_Control 所有权限, |
| | | OBSACLRead_Object 读桶中的对象, |
| | | OBSACLFull_Control_Object 拥有对象的所有权限, |
| | | |
| | | */ |
| | | @property (nonatomic, assign) OBSACL permission; |
| | | |
| | | /** |
| | | 初始化授权对象 |
| | | |
| | | @param grantee 授权用户对象 |
| | | @param permission 权限对象 |
| | | @return 授权对象 |
| | | */ |
| | | -(instancetype)initWithGrantee:(__kindof OBSAbstractACLGrantee*) grantee permission:(OBSACL) permission; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 用户访问权限控制 |
| | | */ |
| | | @interface OBSAccessControlPolicy: OBSBaseEntity |
| | | |
| | | /** |
| | | 用户对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSUser *owner; |
| | | |
| | | /** |
| | | 访问控制列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSACLGrant*> *accessControlList; |
| | | |
| | | /** |
| | | 初始化用户访问控制权限 |
| | | |
| | | @param owner 拥有者对象 |
| | | @return 用户访问控制权限对象 |
| | | */ |
| | | -(instancetype)initWithOwner:(OBSUser*) owner; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - CORS |
| | | |
| | | /** |
| | | 跨域资源共享规则 |
| | | */ |
| | | @interface OBSCORSRule: OBSBaseEntity<OBSMTLDictionaryItemOrderProtocol> |
| | | |
| | | /** |
| | | 一条Rule的标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | /** |
| | | CORS规则允许的请求方法 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *allowedMethodList; |
| | | |
| | | /** |
| | | CORS规则允许的域名字符串 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *allowedOriginList; |
| | | |
| | | /** |
| | | CORS请求中允许携带的头域 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *allowedHeaderList; |
| | | |
| | | /** |
| | | 可以缓存的CORS响应时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *maxAgeSeconds; |
| | | |
| | | /** |
| | | CORS响应中带的附加头域 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *exposeHeaderList; |
| | | @end |
| | | |
| | | #pragma mark - storage policy |
| | | // 存储策略 |
| | | @interface OBSStoragePolicy : OBSBaseEntity |
| | | @property (nonatomic, assign) OBSStorageClass defaultStorageClass; |
| | | /** |
| | | 存储策略初始化 |
| | | |
| | | @param storageClass 存储种类 |
| | | OBSStorageClassNULL0, |
| | | OBSStorageClassStandard(标准存储), |
| | | OBSStorageClassStandardIA(低频访问存储), |
| | | OBSStorageClassGlacier(归档存储) |
| | | @return 存储策略对象 |
| | | */ |
| | | -(instancetype)initWithStorageClass:(OBSStorageClass) storageClass; |
| | | @end |
| | | |
| | | #pragma mark bucket location configuration |
| | | @interface OBSBucketConfiguration: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *locationConstraint; |
| | | -(instancetype)initWithLocationConstraint:(NSString*) location; |
| | | @end |
| | | |
| | | #pragma mark bucket replication rule |
| | | @interface OBSReplicateBucketRule: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *replicateBucketRule; |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | @property (nonatomic, assign) OBSReplicateStatus status; |
| | | @property (nonatomic, strong, nonnull) NSString *destination; |
| | | |
| | | -(instancetype)initWithID:(NSString*) ID prefix:(NSString*) prefix status:(OBSReplicateStatus) status destination:(NSString*) destination; |
| | | |
| | | @end |
| | | |
| | | |
| | | |
| | | #pragma mark bucket quota |
| | | // 桶存储容量 |
| | | @interface OBSQuota: OBSBaseEntity |
| | | |
| | | /** |
| | | 存储容量 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *storageQuota; |
| | | |
| | | /** |
| | | 初始化桶存储容量对象 |
| | | |
| | | @param storageQuotaNumber 容量大小 |
| | | @return 桶存储容量对象 |
| | | */ |
| | | -(instancetype)initWithQuotaNumber:(NSNumber*)storageQuotaNumber; |
| | | @end |
| | | #pragma mark bucket logging |
| | | @interface OBSLoggingEnabled: OBSBaseEntity<OBSMTLDictionaryItemOrderProtocol> |
| | | @property (nonatomic, strong, nonnull) NSString *targetBucket; |
| | | @property (nonatomic, strong, nonnull) NSString *targetPrefix; |
| | | /** |
| | | 产生logging日志桶Owner创建委托OBS上传logging日志的委托名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *agency; |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSACLGrant*> *targetGrantsList; |
| | | -(instancetype)initWithTargetBucket:(NSString*)targetBucket targetPrefix:(NSString*) targetPrefix; |
| | | @end |
| | | |
| | | #pragma mark bucket policy |
| | | |
| | | /** |
| | | 被授权人 |
| | | */ |
| | | @interface OBSPolicyPrincipal: OBSBaseEntity |
| | | |
| | | /** |
| | | 账户类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *accountType; |
| | | |
| | | /** |
| | | Principal授权格式 |
| | | |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *accountARNList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | condition具体配置 |
| | | */ |
| | | @interface OBSPolicyConditionItem: OBSBaseEntity |
| | | |
| | | /** |
| | | 从左边开始匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *leftExpression; |
| | | |
| | | /** |
| | | 从右边开始匹配的字符串数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSArray<NSString*> *rightExpressionList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | statement生效条件 |
| | | */ |
| | | @interface OBSPolicyCondition: OBSBaseEntity |
| | | |
| | | /** |
| | | 字符串匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEquals; |
| | | |
| | | /** |
| | | 字符串不匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringNotEquals; |
| | | |
| | | /** |
| | | 忽略大小写的字符串匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEqualsIgnoreCase; |
| | | |
| | | /** |
| | | 不忽略大小写的字符串匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEqualsNotIgnoreCase; |
| | | |
| | | /** |
| | | 宽松的区分大小写的匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringLike; |
| | | |
| | | /** |
| | | 非宽松区别大小写的匹配 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringNotLike; |
| | | |
| | | /** |
| | | 相等 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericEquals; |
| | | |
| | | /** |
| | | 不相等 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericNotEquals; |
| | | |
| | | /** |
| | | 小于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericLessThan; |
| | | |
| | | /** |
| | | 小于等于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericLessThanEquals; |
| | | |
| | | /** |
| | | 大于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericGreaterThan; |
| | | |
| | | /** |
| | | 大于等于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericGreaterThanEquals; |
| | | |
| | | |
| | | |
| | | /** |
| | | 日期时间相等 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateEquals; |
| | | |
| | | /** |
| | | 日期时间不相等 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateNotEquals; |
| | | |
| | | /** |
| | | 日期时间小于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateLessThan; |
| | | |
| | | /** |
| | | 日期时间小于等于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateLessThanEquals; |
| | | |
| | | /** |
| | | 日期时间大于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateGreaterThan; |
| | | |
| | | /** |
| | | 日期时间大于等于 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateGreaterThanEquals; |
| | | |
| | | |
| | | /** |
| | | 严格布尔值相等 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *booL; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *binaryEquals; |
| | | |
| | | |
| | | /** |
| | | 指定的IP或IP范围 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *IpAddress; |
| | | |
| | | /** |
| | | 不包含指定的IP或IP范围 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *notIpaddress; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnEquals; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnNotEquals; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnLike; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnNotLike; |
| | | |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringNotEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEqualsIgnoreCaseIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringEqualsNotIgnoreCaseIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringLikeIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *stringNotLikeIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericNotEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericLessThanIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericLessThanEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericGreaterThanIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *numericGreaterThanEqualsIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateNotEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateLessThanIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateLessThanEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateGreaterThanIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *dateGreaterThanEqualsIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *booLIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *binaryEqualsIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *IpAddressIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *notIpaddressIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnNotEqualsIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnLikeIfExists; |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *arnNotLikeIfExists; |
| | | |
| | | @property (nonatomic, strong, nonnull) OBSPolicyConditionItem *nulL; |
| | | |
| | | @end |
| | | |
| | | /** |
| | | 策略声明 |
| | | */ |
| | | @interface OBSPolicyStatement: OBSBaseEntity |
| | | |
| | | /** |
| | | statement ID 描述statement的字符串 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *sid; |
| | | |
| | | /** |
| | | 本条statement的权限 |
| | | |
| | | OBSPolicyEffectAllow, |
| | | OBSPolicyEffectDeny, |
| | | */ |
| | | @property (nonatomic, assign) OBSPolicyEffect effect; |
| | | |
| | | /** |
| | | 被授权人 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyPrincipal *principal; |
| | | |
| | | /** |
| | | 不被授权人 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyPrincipal *notPrincipal; |
| | | |
| | | /** |
| | | 本条statement生效条件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSPolicyCondition *condition; |
| | | |
| | | /** |
| | | 本条statement作用的操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<NSString*> *actionList; |
| | | |
| | | /** |
| | | 不被匹配的作用的操作 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<NSString*> *notActionList; |
| | | |
| | | /** |
| | | 起作用的一组资源 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<NSString*> *resourceList; |
| | | |
| | | /** |
| | | 不起作用的一组资源 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<NSString*> *notResourceList; |
| | | |
| | | /** |
| | | 初始化策略声明 |
| | | |
| | | @param sid statement ID |
| | | @param effect 权限类型 |
| | | @return 策略声明对象 |
| | | */ |
| | | -(instancetype)initWithSid:(NSString*) sid effect:(OBSPolicyEffect) effect; |
| | | @end |
| | | |
| | | #pragma mark bucket lifecycle |
| | | |
| | | /** |
| | | 生命周期配置中表示迁移时间和迁移后对象存储级别的元素(仅针对对象的最新版本) |
| | | */ |
| | | @interface OBSLifecycleTransition : OBSBaseEntity |
| | | |
| | | /** |
| | | 对象创建时间后第几天时规则生效 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *days; |
| | | |
| | | /** |
| | | 对象将被修改成的存储级别 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 初始化生命周期迁移时间及对象存储级别 |
| | | |
| | | @param days 第几天生效 |
| | | @param storageClass 修改成的存储级别 |
| | | @return 迁移时间及对象存储级别对象 |
| | | */ |
| | | -(instancetype)initWithDays:(NSNumber*) days storageClass:(OBSStorageClass) storageClass; |
| | | @end |
| | | |
| | | /** |
| | | 历史版本迁移时间和迁移后对象存储级别的元素 |
| | | */ |
| | | @interface OBSLifecycleNoncurrentVersionTransition : OBSBaseEntity |
| | | |
| | | /** |
| | | 第几天生效 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *noncurrentDays; |
| | | |
| | | /** |
| | | 修改成的存储级别 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 初始化历史版本迁移时间和迁移后对象存储级别的元素 |
| | | |
| | | @param days 第几天生效 |
| | | @param storageClass 修改成的存储级别 |
| | | @return 历史版本迁移时间和迁移后对象存储级别对象 |
| | | */ |
| | | -(instancetype)initWithDays:(NSNumber*) days storageClass:(OBSStorageClass) storageClass; |
| | | @end |
| | | |
| | | /** |
| | | 生命周期配置中表示过期时间的Container |
| | | */ |
| | | @interface OBSLifecycleExpiration: OBSBaseEntity |
| | | |
| | | /** |
| | | 过期时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *days; |
| | | |
| | | /** |
| | | 初始化过期时间对象 |
| | | |
| | | @param days 过期时间 |
| | | @return 过期时间对象 |
| | | */ |
| | | -(instancetype)initWithDays:(NSNumber*) days; |
| | | @end |
| | | |
| | | /** |
| | | 历史版本过期时间的Container |
| | | */ |
| | | @interface OBSLifecycleNoncurrentVersionExpiration: OBSBaseEntity |
| | | |
| | | /** |
| | | 历史版本过期时间 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *noncurrentDays; |
| | | |
| | | /** |
| | | 初始化历史版本过期时间的Container |
| | | |
| | | @param days 过期时间 |
| | | @return 历史版本过期时间的Container对象 |
| | | */ |
| | | -(instancetype)initWithDays:(NSNumber*) days; |
| | | @end |
| | | |
| | | /** |
| | | 生命周期配置 |
| | | */ |
| | | @interface OBSLifecycleRule : OBSBaseEntity |
| | | |
| | | /** |
| | | ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | /** |
| | | 对象名前缀 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *prefix; |
| | | |
| | | /** |
| | | 标识当前Rule是否启用 |
| | | */ |
| | | @property (nonatomic, assign) OBSLifecycleStatus status; |
| | | |
| | | /** |
| | | 生命周期配置中表示迁移时间和迁移后对象存储级别的元素(仅针对对象的最新版本) |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLifecycleTransition*> *transitionList; |
| | | |
| | | /** |
| | | 生命周期配置中表示对象的历史版本迁移时间和迁移后对象存储级别的元素 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLifecycleNoncurrentVersionTransition*> *noncurrentVersionTransitionList; |
| | | |
| | | /** |
| | | 生命周期配置中表示过期时间的Container (仅针对对象的最新版本) |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSLifecycleExpiration *expiration; |
| | | |
| | | /** |
| | | 生命周期配置中表示历史版本过期时间的Container。您可以将该动作设置在已启用多版本(或暂停)的桶,来让系统删除对象的满足特定生命周期的历史版本(仅针对历史版本) |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSLifecycleNoncurrentVersionExpiration *noncurrentVersionExpiration; |
| | | |
| | | /** |
| | | 初始化生命周期配置 |
| | | |
| | | @param ID ID |
| | | @param prefix 对象名前缀 |
| | | @param status 标识当前Rule的启用状态 |
| | | @return 生命周期配置对象 |
| | | */ |
| | | -(instancetype)initWithID:(NSString*) ID prefix:(NSString*) prefix status:(OBSLifecycleStatus) status; |
| | | @end |
| | | |
| | | #pragma mark bucket website |
| | | |
| | | @interface OBSAbstractWebsiteConf: OBSBaseEntity |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 配置所有请求重定向 |
| | | */ |
| | | @interface OBSWebsiteConfRedirectAll : OBSAbstractWebsiteConf |
| | | |
| | | /** |
| | | 重定向站点名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *hostName; |
| | | |
| | | /** |
| | | 请求种类 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *protocol; |
| | | |
| | | /** |
| | | 初始化配置所有请求重定向 |
| | | |
| | | @param hostName 重定向站点名 |
| | | @return 所有请求的重定向设置 |
| | | */ |
| | | -(instancetype)initWithHostName:(NSString*)hostName; |
| | | @end |
| | | |
| | | /** |
| | | 默认主页面 |
| | | */ |
| | | @interface OBSWebsiteConfCustomIndexDocument: OBSBaseEntity |
| | | |
| | | /** |
| | | 网页名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *suffix; |
| | | |
| | | /** |
| | | 初始化默认加载页面 |
| | | |
| | | @param suffix 网页名 |
| | | @return 默认主页面 |
| | | */ |
| | | -(instancetype)initWithSuffix:(NSString*)suffix; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 默认错误页面 |
| | | */ |
| | | @interface OBSWebsiteConfCustomErrorDocument: OBSBaseEntity |
| | | |
| | | /** |
| | | 网页名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | |
| | | /** |
| | | 初始化错误加载页面 |
| | | |
| | | @param key 网页名 |
| | | @return 错误加载页面 |
| | | */ |
| | | -(instancetype)initWithKey:(NSString*)key; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 网站托管自定义规则设置 |
| | | */ |
| | | @interface OBSWebsiteConfCustomRedirect: OBSBaseEntity |
| | | |
| | | /** |
| | | 请求种类 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *protocol; |
| | | |
| | | /** |
| | | 重定向站点 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *hostName; |
| | | |
| | | /** |
| | | 重定向目录 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *replaceKeyPrefixWith; |
| | | |
| | | /** |
| | | 重定向对象 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *replaceKeyWith; |
| | | |
| | | /** |
| | | 重定向状态码 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *httpRedirectCode; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 重定向规则匹配的条件元素 |
| | | */ |
| | | @interface OBSWebsiteConfCustomCondition: OBSBaseEntity |
| | | |
| | | /** |
| | | 前缀名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *keyPrefixEquals; |
| | | |
| | | /** |
| | | 错误码 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *httpErrorCodeReturnedEquals; |
| | | |
| | | /** |
| | | 初始化重定向规则匹配的元素 |
| | | |
| | | @param keyPrefix 前缀名 |
| | | @return 重定向规则匹配的元素 |
| | | */ |
| | | -(instancetype)initWithKeyPrefix:(NSString*) keyPrefix; |
| | | |
| | | /** |
| | | 初始化重定向规则匹配的元素 |
| | | |
| | | @param httpErrorCodeReturned 错误码 |
| | | @return 重定向规则匹配的元素 |
| | | */ |
| | | -(instancetype)initWithKeyErrorCode:(NSString*) httpErrorCodeReturned; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 路由规则 |
| | | */ |
| | | @interface OBSWebsiteConfCustomRoutingRule: OBSBaseEntity |
| | | |
| | | /** |
| | | 重定向规则匹配的条件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSWebsiteConfCustomCondition *condition; |
| | | |
| | | /** |
| | | 重定向配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSWebsiteConfCustomRedirect *redirect; |
| | | |
| | | /** |
| | | 初始化路由规则 |
| | | |
| | | @param condition 重定向规则匹配的条件 |
| | | @param redirect 重定向配置 |
| | | @return 路由规则 |
| | | */ |
| | | -(instancetype)initWithCondition:(OBSWebsiteConfCustomCondition*) condition redirect:(OBSWebsiteConfCustomRedirect*) redirect; |
| | | @end |
| | | |
| | | /** |
| | | 自定义网站配置 |
| | | */ |
| | | @interface OBSWebsiteConfCustom: OBSAbstractWebsiteConf |
| | | |
| | | /** |
| | | 默认访问页面 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSWebsiteConfCustomIndexDocument*> *indexDocumentList; |
| | | |
| | | /** |
| | | 错误跳转页面 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSWebsiteConfCustomErrorDocument*> *errorDocumentList; |
| | | |
| | | /** |
| | | 路由规则表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSWebsiteConfCustomRoutingRule*> *routingRulesList; |
| | | @end |
| | | |
| | | |
| | | #pragma mark bucket versioning |
| | | // 桶多版本配置 |
| | | @interface OBSBucketVersioningConfiguration : OBSBaseEntity |
| | | |
| | | /** |
| | | 桶多版本状态 |
| | | */ |
| | | @property (nonatomic, assign) OBSVersioningStatus status; |
| | | @end |
| | | |
| | | #pragma mark bucket nofitication |
| | | |
| | | /** |
| | | 定义过滤规则键值对的元素 |
| | | */ |
| | | @interface OBSNotificationFilterRule : OBSBaseEntity<OBSMTLDictionaryItemOrderProtocol> |
| | | |
| | | /** |
| | | 指定规则按对象名前缀或后缀进行过滤 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *name; |
| | | |
| | | /** |
| | | 指定的对象名关键字 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *value; |
| | | |
| | | /** |
| | | 初始化定义过滤规则键值对的元素 |
| | | |
| | | @param name 指定规则按对象名前缀或后缀进行过滤 |
| | | @param value 指定的对象名关键字 |
| | | @return 过滤规则键值对的元素 |
| | | */ |
| | | -(instancetype)initWithName:(NSString*) name value:(NSString*)value; |
| | | @end |
| | | |
| | | /** |
| | | 通知设置 |
| | | */ |
| | | @interface OBSNotificationFilter : OBSBaseEntity |
| | | |
| | | /** |
| | | 通知设置的具体规则 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSNotificationFilterRule*> *filterRuleList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 配置事件通知元素的主题 |
| | | */ |
| | | @interface OBSNotificationTopicConfiguration : OBSBaseEntity<OBSMTLDictionaryItemOrderProtocol> |
| | | |
| | | /** |
| | | 每项事件通知配置的唯一标识 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *ID; |
| | | |
| | | /** |
| | | 保存过滤对象名的一组规则 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSNotificationFilter *filter; |
| | | |
| | | /** |
| | | 事件通知主题的URN |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *topic; |
| | | |
| | | /** |
| | | 事件列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<NSString*> *eventList; |
| | | @end |
| | | #pragma mark bucket tagging |
| | | @interface OBSBucketTag : OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSString *key; |
| | | @property (nonatomic, strong, nonnull) NSString *value; |
| | | -(instancetype)initWithKey:(NSString*) key value:(NSString*)value; |
| | | @end |
| | | |
| | | #pragma mark part |
| | | @interface OBSPart: OBSBaseEntity |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumber; |
| | | @property (nonatomic, strong, nullable) NSDate *lastModified; |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | @property (nonatomic, strong, nullable) NSNumber *size; |
| | | -(instancetype)initWithPartNumber:(NSNumber*) partNumber etag:(NSString*)etag; |
| | | @end |
| | | #endif /* OBSServiceRequestCommonEntity_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSServiceDefine_h |
| | | #define OBSServiceDefine_h |
| | | #import "OBSBaseConstDefinition.h" |
| | | |
| | | |
| | | #define OBSCORSHTTPGET @"GET" |
| | | #define OBSCORSHTTPPUT @"PUT" |
| | | #define OBSCORSHTTPHEAD @"HEAD" |
| | | #define OBSCORSHTTPPOST @"POST" |
| | | #define OBSCORSHTTPDELETE @"DELETE" |
| | | |
| | | |
| | | // canonical headedrs key |
| | | static NSString *const OBSCanonicalPrefix =@"x-amz-"; |
| | | static NSString *const OBSCanonicalMetaPrefix =@"x-obs-meta-"; |
| | | static NSString *const OBSV2MetaPrefix =@"x-amz-meta-"; |
| | | static NSString *const OBSCanonicalDateKey =@"x-amz-date"; |
| | | static NSString *const OBSCanonicalContentSha256Key =@"x-amz-content-sha256"; |
| | | static NSString *const OBSCanonicalRequestIDKey =@"x-amz-request-id"; |
| | | static NSString *const OBSSTSTokenHeaderKey =@"x-amz-security-token"; |
| | | static NSString *const OBSServiceName =@"s3"; |
| | | |
| | | static NSString *const OBSCanonicalPrefix_OBS =@"x-obs-"; |
| | | static NSString *const OBSCanonicalMetaPrefix_OBS =@"x-obs-meta-"; |
| | | static NSString *const OBSCanonicalDateKey_OBS =@"x-obs-date"; |
| | | static NSString *const OBSCanonicalContentSha256Key_OBS =@"x-obs-content-sha256"; |
| | | static NSString *const OBSCanonicalRequestIDKey_OBS =@"x-obs-request-id"; |
| | | static NSString *const OBSSTSTokenHeaderKey_OBS =@"x-obs-security-token"; |
| | | static NSString *const OBSServiceName_OBS =@"s3"; |
| | | |
| | | static NSString *const OBSEncryptionKMSKey =@"aws:kms"; |
| | | static NSString *const OBSMetaDataDictKey =@"metaDataDict"; |
| | | |
| | | static NSString *const OBSDefaultRegion =@"china"; |
| | | static NSString *const OBSSigV4Marker =@"AWS4"; |
| | | static NSString *const OBSSigV4Algorithm =@"AWS4-HMAC-SHA256"; |
| | | static NSString *const OBSSigV4Terminator =@"aws4_request"; |
| | | |
| | | static NSString *const OBSHeaderContentMD5Key =@"Content-MD5"; |
| | | |
| | | static NSString *const OBSSubResourceACLKey =@"acl"; |
| | | static NSString *const OBSSubResourceLifecycleKey =@"lifecycle"; |
| | | static NSString *const OBSSubResourceLocationKey =@"location"; |
| | | static NSString *const OBSSubResourceLoggingKey =@"logging"; |
| | | static NSString *const OBSSubResourceNotificationKey =@"notification"; |
| | | static NSString *const OBSSubResourcePartNumberKey =@"partNumber"; |
| | | static NSString *const OBSSubResourcePolicyKey =@"policy"; |
| | | static NSString *const OBSSubResourceUploadIDKey =@"uploadId"; |
| | | static NSString *const OBSSubResourceUploadsKey =@"uploads"; |
| | | static NSString *const OBSSubResourceAppendKey =@"append"; |
| | | static NSString *const OBSSubResourcePositionKey =@"position"; |
| | | static NSString *const OBSSubResourceVersionIDKey =@"versionId"; |
| | | static NSString *const OBSSubResourceImageProcessKey =@"x-image-process"; |
| | | static NSString *const OBSSubResourceVersioningKey =@"versioning"; |
| | | static NSString *const OBSSubResourceVersionsKey =@"versions"; |
| | | static NSString *const OBSSubResourceWebsiteKey =@"website"; |
| | | static NSString *const OBSSubResourceQuotaKey =@"quota"; |
| | | static NSString *const OBSSubResourceStoragePolicyKey =@"storagePolicy"; |
| | | static NSString *const OBSSubResourceStoragePolicyKey_OBS =@"storageClass"; |
| | | static NSString *const OBSSubResourceReplicateBucketKey =@"replication"; |
| | | static NSString *const OBSSubResourceStorageInfoKey =@"storageinfo"; |
| | | static NSString *const OBSSubResourceCORSKey =@"cors"; |
| | | static NSString *const OBSSubResourceDeleteKey =@"delete"; |
| | | static NSString *const OBSSubResourceRestoreKey =@"restore"; |
| | | static NSString *const OBSSubResourceResponseContentTypeKey =@"response-content-type"; |
| | | static NSString *const OBSSubResourceResponseContentLanguageKey=@"response-content-language"; |
| | | static NSString *const OBSSubResourceResponseExpiresKey =@"response-expires"; |
| | | static NSString *const OBSSubResourceResponseCacheControlKey =@"response-cache-control"; |
| | | static NSString *const OBSSubResourceResponseContentDispositionKey=@"response-content-disposition"; |
| | | static NSString *const OBSSubResourceResponseContentEncodingKey=@"response-content-encoding"; |
| | | static NSString *const OBSSubResourceTaggingKey =@"tagging"; |
| | | |
| | | |
| | | |
| | | static NSString *const OBSUserAttributeKey =@"xsi:type"; |
| | | static NSString *const OBSUserURIKey =@"URI"; |
| | | |
| | | static NSString *const OBSUserAuthenticatedUsersURI =@"http://acs.amazonaws.com/groups/global/AuthenticatedUsers"; |
| | | static NSString *const OBSUserAllUsersURI =@"http://acs.amazonaws.com/groups/global/AllUsers"; |
| | | static NSString *const OBSUserLogDeliveryURI =@"http://acs.amazonaws.com/groups/s3/LogDelivery"; |
| | | |
| | | |
| | | #pragma mark -Enum |
| | | |
| | | #pragma mark -Enum |
| | | |
| | | |
| | | /** |
| | | * OBSACLPolicy枚举 |
| | | * |
| | | * OBS 预定义的权限控制策略 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSACLPolicy){ |
| | | /** |
| | | * 默认权限 |
| | | */ |
| | | OBSACLPolicyNULL0, |
| | | /** |
| | | * 桶或对象的所有者拥有完全控制的权限,其他任何人都没有访问权限(自研/旧版本) |
| | | */ |
| | | OBSACLPolicyPrivate, |
| | | /** |
| | | * 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读的权限(自研/旧版本) |
| | | */ |
| | | OBSACLPolicyPublicRead, |
| | | /** |
| | | * 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读和写的权限(自研/旧版本) |
| | | */ |
| | | OBSACLPolicyPublicReadWrite, |
| | | /** |
| | | * 桶或对象的所有者拥有完全控制的权限,其他OBS授权用户拥有读权限 |
| | | */ |
| | | OBSACLPolicyAuthenticatedRead, |
| | | /** |
| | | * 对象的所有者拥有完全控制的权限,桶的所有者拥有只读的权限 |
| | | */ |
| | | OBSACLPolicyBucketOwnerRead, |
| | | /** |
| | | * 对象的所有者拥有完全控制的权限,桶的所有者拥有完全控制的权限 |
| | | */ |
| | | OBSACLPolicyBucketOwnerFullControl, |
| | | /** |
| | | * 日志投递用户组拥有对桶的写权限以及读ACP的权限 |
| | | */ |
| | | OBSACLPolicyLogDeliveryWrite, |
| | | /** |
| | | * 设在桶上,所有人可以获取该桶内对象列表、桶内多段任务、桶的元数据,可以获取该桶内对象的内容和元数据。不能应用在对象上。(自研协议) |
| | | */ |
| | | OBSACLPolicyPublicReadDelivered, |
| | | /** |
| | | * 设在桶上,所有人可以获取该桶内对象列表、桶内多段任务、桶的元数据、上传对象删除对象、初始化段任务、上传段、合并段、拷贝段、取消多段上传任务,可以获取该桶内对象的内容和元数据。 |
| | | 不能应用在对象上。(自研协议) |
| | | */ |
| | | OBSACLPolicyPublicReadWriteDelivered, |
| | | |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * OBSACL枚举 |
| | | * |
| | | * 支持的桶或对象权限 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSACL){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSACLNULL0, |
| | | /** |
| | | * 若有桶的读权限,则可以获取该桶内对象列表和桶的元数据。若有对象的读权限,则可以获取该对象内容和元数据 |
| | | */ |
| | | OBSACLRead, |
| | | /** |
| | | * 若有桶的写权限,则可以上传、覆盖和删除该桶内任何对象。此权限在对象上不适用 |
| | | */ |
| | | OBSACLWrite, |
| | | /** |
| | | * 若有读ACP的权限,则可以获取对应的桶或对象的权限控制列 表(ACL)。桶或对象的所有者永远拥有读对应桶或对象ACP的权限 |
| | | */ |
| | | OBSACLRead_ACP, |
| | | /** |
| | | * 若有写ACP的权限,则可以更新对应桶或对象的权限控制列表 (ACL)。桶或对象的所有者永远拥有写对应桶或对象的ACP的权限。 拥有了写ACP的权限,由于可以更改权限控制策略,实际上意味着拥有了完全访问的权限 |
| | | */ |
| | | OBSACLWrite_ACP, |
| | | /** |
| | | * 若有桶的完全控制权限意味着拥有READ、WRITE、 READ_ACP WRITE_ACP的权限。若有对象的完全控制权限意味着拥有READ、READ_ACP和 WRITE_ACP的权限。READ_ONLY的用户不受此限制 |
| | | */ |
| | | OBSACLFull_Control, |
| | | /** |
| | | * 对象的读权限,则可以获取该对象内容和元数据 |
| | | */ |
| | | OBSACLRead_Object, |
| | | /** |
| | | * 对象的完全控制权限意味着拥有READ、READ_ACP和 WRITE_ACP的权限。READ_ONLY的用户不受此限制 |
| | | */ |
| | | OBSACLFull_Control_Object, |
| | | }; |
| | | |
| | | /** |
| | | * OBSACLUserType |
| | | * |
| | | * 用户类型 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSACLUserType){ |
| | | /** |
| | | * 默认组 |
| | | */ |
| | | OBSACLUserTypeNULL0, |
| | | /** |
| | | * 授予OBS用户 |
| | | */ |
| | | OBSACLUserTypeCanonicalUser, |
| | | /** |
| | | * 授予注册用户组 |
| | | */ |
| | | OBSACLUserTypeAuthenticatedUsers, |
| | | /** |
| | | * 授予匿名用户 |
| | | */ |
| | | OBSACLUserTypeAllUsers, |
| | | /** |
| | | * 日志投递用户组 |
| | | */ |
| | | OBSACLUserTypeLogDelivery, |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * OBSStorageClass |
| | | * |
| | | * 桶的存储类型 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSStorageClass){ |
| | | /** |
| | | * 默认存储类型 |
| | | */ |
| | | OBSStorageClassNULL0, |
| | | /** |
| | | * 标准存储 |
| | | */ |
| | | OBSStorageClassStandard, |
| | | /** |
| | | * 低频访问存储 |
| | | */ |
| | | OBSStorageClassStandardIA, |
| | | /** |
| | | * 归档存储 |
| | | */ |
| | | OBSStorageClassGlacier, |
| | | |
| | | }; |
| | | |
| | | typedef NS_ENUM(NSInteger, OBSReplicateStatus){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSReplicateStatusNULL0, |
| | | /** |
| | | * enable状态 |
| | | */ |
| | | OBSReplicateStatusEnable, |
| | | /** |
| | | * disable状态 |
| | | */ |
| | | OBSReplicateStatusDisable, |
| | | |
| | | |
| | | }; |
| | | |
| | | /** |
| | | * OBSVersioningStatus |
| | | * |
| | | * 多版本状态 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSVersioningStatus){ |
| | | /** |
| | | * 默认配置 |
| | | */ |
| | | OBSVersioningStatusNULL0, |
| | | /** |
| | | * 开启 |
| | | */ |
| | | OBSVersioningStatusEnabled, |
| | | /** |
| | | * 关闭 |
| | | */ |
| | | OBSVersioningStatusSuspended, |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * OBSLifecycleStatus |
| | | * |
| | | * 桶生命周期状态 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSLifecycleStatus){ |
| | | /** |
| | | * 默认配置 |
| | | */ |
| | | OBSLifecycleStatusNULL0, |
| | | /** |
| | | * 开启 |
| | | */ |
| | | OBSLifecycleStatusEnabled, |
| | | /** |
| | | * 关闭 |
| | | */ |
| | | OBSLifecycleStatusSuspended, |
| | | }; |
| | | |
| | | /** |
| | | * OBSPolicyEffect |
| | | * |
| | | * 策略的响应状态 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSPolicyEffect){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSPolicyEffectNULL0, |
| | | /** |
| | | * 允许 |
| | | */ |
| | | OBSPolicyEffectAllow, |
| | | /** |
| | | * 拒绝 |
| | | */ |
| | | OBSPolicyEffectDeny, |
| | | }; |
| | | |
| | | /** |
| | | * OBSMetaDirective |
| | | * |
| | | * 此参数用来指定新对象的元数据是从源对象中复制,还是用请求中的元数据替换 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSMetaDirective){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSMetaDirectiveNULL0, |
| | | /** |
| | | * 复制 |
| | | */ |
| | | OBSMetaDirectiveCopy, |
| | | /** |
| | | * 替换 |
| | | */ |
| | | OBSMetaDirectiveReplace, |
| | | }; |
| | | |
| | | /** |
| | | * OBSRestoreTier |
| | | * |
| | | * 归档取回方式 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSRestoreTier){ |
| | | /** |
| | | * 默认 |
| | | */ |
| | | OBSRestoreTierNULL0, |
| | | /** |
| | | * 表示标准取回对象,取回耗时3~5 h |
| | | */ |
| | | OBSRestoreTierStandard, |
| | | /** |
| | | * 表示快速取回对 象,取回耗时1~5 min, |
| | | */ |
| | | OBSRestoreTierExpedited, |
| | | /** |
| | | * OBSRestoreTierBulk |
| | | */ |
| | | OBSRestoreTierBulk, |
| | | }; |
| | | |
| | | /** |
| | | * OBSDomainMode |
| | | * |
| | | * 域名访问方式 |
| | | * |
| | | */ |
| | | typedef NS_ENUM(NSInteger, OBSDomainMode){ |
| | | /** |
| | | * 默认域名访问方式 |
| | | */ |
| | | OBSDomainModeNULL0, |
| | | /** |
| | | * 自定义域名访问 |
| | | */ |
| | | OBSDomainModeCustom, |
| | | |
| | | }; |
| | | |
| | | #define OBSPolicyActionAbortMultipartUpload @"s3:AbortMultipartUpload" |
| | | #define OBSPolicyActionDeleteObject @"s3:DeleteObject" |
| | | #define OBSPolicyActionDeleteObjectTagging @"s3:DeleteObjectTagging" |
| | | #define OBSPolicyActionDeleteObjectVersion @"s3:DeleteObjectVersion" |
| | | #define OBSPolicyActionDeleteObjectVersionTagging @"s3:DeleteObjectVersionTagging" |
| | | #define OBSPolicyActionGetObject @"s3:GetObject" |
| | | #define OBSPolicyActionGetObjectAcl @"s3:GetObjectAcl" |
| | | #define OBSPolicyActionGetObjectTagging @"s3:GetObjectTagging" |
| | | #define OBSPolicyActionGetObjectTorrent @"s3:GetObjectTorrent" |
| | | #define OBSPolicyActionGetObjectVersion @"s3:GetObjectVersion" |
| | | #define OBSPolicyActionGetObjectVersionAcl @"s3:GetObjectVersionAcl" |
| | | #define OBSPolicyActionGetObjectVersionTagging @"s3:GetObjectVersionTagging" |
| | | #define OBSPolicyActionGetObjectVersionTorrent @"s3:GetObjectVersionTorrent" |
| | | #define OBSPolicyActionListMultipartUploadParts @"s3:ListMultipartUploadParts" |
| | | #define OBSPolicyActionPutObject @"s3:PutObject" |
| | | #define OBSPolicyActionPutObjectAcl @"s3:PutObjectAcl" |
| | | #define OBSPolicyActionPutObjectTagging @"s3:PutObjectTagging" |
| | | #define OBSPolicyActionPutObjectVersionAcl @"s3:PutObjectVersionAcl" |
| | | #define OBSPolicyActionPutObjectVersionTagging @"s3:PutObjectVersionTagging" |
| | | #define OBSPolicyActionRestoreObject @"s3:RestoreObject" |
| | | #define OBSPolicyActionCreateBucket @"s3:CreateBucket" |
| | | #define OBSPolicyActionDeleteBucket @"s3:DeleteBucket" |
| | | #define OBSPolicyActionListBucket @"s3:ListBucket" |
| | | #define OBSPolicyActionListBucketVersions @"s3:ListBucketVersions" |
| | | #define OBSPolicyActionListAllMyBuckets @"s3:ListAllMyBuckets" |
| | | #define OBSPolicyActionListBucketMultipartUploads @"s3:ListBucketMultipartUploads" |
| | | #define OBSPolicyActionDeleteBucketPolicy @"s3:DeleteBucketPolicy" |
| | | #define OBSPolicyActionDeleteBucketWebsite @"s3:DeleteBucketWebsite" |
| | | #define OBSPolicyActionDeleteReplicationConfiguration @"s3:DeleteReplicationConfiguration" |
| | | #define OBSPolicyActionGetAccelerateConfiguration @"s3:GetAccelerateConfiguration" |
| | | #define OBSPolicyActionGetAnalyticsConfiguration @"s3:GetAnalyticsConfiguration" |
| | | #define OBSPolicyActionGetBucketAcl @"s3:GetBucketAcl" |
| | | #define OBSPolicyActionGetBucketCORS @"s3:GetBucketCORS" |
| | | #define OBSPolicyActionGetBucketLocation @"s3:GetBucketLocation" |
| | | #define OBSPolicyActionGetBucketLogging @"s3:GetBucketLogging" |
| | | #define OBSPolicyActionGetBucketNotification @"s3:GetBucketNotification" |
| | | #define OBSPolicyActionGetBucketPolicy @"s3:GetBucketPolicy" |
| | | #define OBSPolicyActionGetBucketRequestPayment @"s3:GetBucketRequestPayment" |
| | | #define OBSPolicyActionGetBucketTagging @"s3:GetBucketTagging" |
| | | #define OBSPolicyActionGetBucketVersioning @"s3:GetBucketVersioning" |
| | | #define OBSPolicyActionGetBucketWebsite @"s3:GetBucketWebsite" |
| | | #define OBSPolicyActionGetEncryptionConfiguration @"s3:GetEncryptionConfiguration" |
| | | #define OBSPolicyActionGetInventoryConfiguration @"s3:GetInventoryConfiguration" |
| | | #define OBSPolicyActionGetLifecycleConfiguration @"s3:GetLifecycleConfiguration" |
| | | #define OBSPolicyActionGetMetricsConfiguration @"s3:GetMetricsConfiguration" |
| | | #define OBSPolicyActionGetReplicationConfiguration @"s3:GetReplicationConfiguration" |
| | | #define OBSPolicyActionPutAccelerateConfiguration @"s3:PutAccelerateConfiguration" |
| | | #define OBSPolicyActionPutAnalyticsConfiguration @"s3:PutAnalyticsConfiguration" |
| | | #define OBSPolicyActionPutBucketAcl @"s3:PutBucketAcl" |
| | | #define OBSPolicyActionPutBucketCORS @"s3:PutBucketCORS" |
| | | #define OBSPolicyActionPutBucketLogging @"s3:PutBucketLogging" |
| | | #define OBSPolicyActionPutBucketNotification @"s3:PutBucketNotification" |
| | | #define OBSPolicyActionPutBucketPolicy @"s3:PutBucketPolicy" |
| | | #define OBSPolicyActionPutBucketRequestPayment @"s3:PutBucketRequestPayment" |
| | | #define OBSPolicyActionPutBucketTagging @"s3:PutBucketTagging" |
| | | #define OBSPolicyActionPutBucketVersioning @"s3:PutBucketVersioning" |
| | | #define OBSPolicyActionPutBucketWebsite @"s3:PutBucketWebsite" |
| | | #define OBSPolicyActionPutEncryptionConfiguration @"s3:PutEncryptionConfiguration" |
| | | #define OBSPolicyActionPutInventoryConfiguration @"s3:PutInventoryConfiguration" |
| | | #define OBSPolicyActionPutLifecycleConfiguration @"s3:PutLifecycleConfiguration" |
| | | #define OBSPolicyActionPutMetricsConfiguration @"s3:PutMetricsConfiguration" |
| | | #define OBSPolicyActionPutReplicationConfiguration @"s3:PutReplicationConfiguration" |
| | | |
| | | // 3.0版本 |
| | | #define OBSPolicyActionCreateBucket_OBS @"CreateBucket" |
| | | #define OBSPolicyActionDeleteBucket_OBS @"DeleteBucket" |
| | | #define OBSPolicyActionListBucket_OBS @"ListBucket" |
| | | #define OBSPolicyActionHeadBucket_OBS @"HeadBucket" |
| | | #define OBSPolicyActionListBucketVersions_OBS @"ListBucketVersions" |
| | | #define OBSPolicyActionListBucketMultipartUploads_OBS @"ListBucketMultipartUploads" |
| | | #define OBSPolicyActionGetBucketAcl_OBS @"GetBucketAcl" |
| | | #define OBSPolicyActionPutBucketAcl_OBS @"PutBucketAcl" |
| | | #define OBSPolicyActionGetBucketCORS_OBS @"GetBucketCORS" |
| | | #define OBSPolicyActionPutBucketCORS_OBS @"PutBucketCORS" |
| | | #define OBSPolicyActionGetBucketVersioning_OBS @"GetBucketVersioning" |
| | | #define OBSPolicyActionPutBucketVersioning_OBS @"PutBucketVersioning" |
| | | #define OBSPolicyActionGetBucketLocation_OBS @"GetBucketLocation" |
| | | #define OBSPolicyActionGetBucketPolicy_OBS @"GetBucketPolicy" |
| | | #define OBSPolicyActionDeleteBucketPolicy_OBS @"DeleteBucketPolicy" |
| | | #define OBSPolicyActionPutBucketPolicy_OBS @"PutBucketPolicy" |
| | | #define OBSPolicyActionGetBucketLogging_OBS @"GetBucketLogging" |
| | | #define OBSPolicyActionPutBucketLogging_OBS @"PutBucketLogging" |
| | | #define OBSPolicyActionGetBucketWebsite_OBS @"GetBucketWebsite" |
| | | #define OBSPolicyActionPutBucketWebsite_OBS @"PutBucketWebsite" |
| | | #define OBSPolicyActionDeleteBucketWebsite_OBS @"DeleteBucketWebsite" |
| | | #define OBSPolicyActionGetLifecycleConfiguration_OBS @"GetLifecycleConfiguration" |
| | | #define OBSPolicyActionPutLifecycleConfiguration_OBS @"PutLifecycleConfiguration" |
| | | #define OBSPolicyActionGetBucketNotification_OBS @"GetBucketNotification" |
| | | #define OBSPolicyActionPutBucketNotification_OBS @"PutBucketNotification" |
| | | #define OBSPolicyActionGetReplicationConfiguration_OBS @"GetReplicationConfiguration" |
| | | #define OBSPolicyActionGetObject_OBS @"GetObject" |
| | | #define OBSPolicyActionGetObjectVersion_OBS @"GetObjectVersion" |
| | | #define OBSPolicyActionPutObject_OBS @"PutObject" |
| | | #define OBSPolicyActionGetObjectAcl_OBS @"GetObjectAcl" |
| | | #define OBSPolicyActionGetObjectVersionAcl_OBS @"GetObjectVersionAcl" |
| | | #define OBSPolicyActionPutObjectAcl_OBS @"PutObjectAcl" |
| | | #define OBSPolicyActionPutObjectVersionAcl_OBS @"PutObjectVersionAcl" |
| | | #define OBSPolicyActionDeleteObject_OBS @"DeleteObject" |
| | | #define OBSPolicyActionDeleteObjectVersion_OBS @"DeleteObjectVersion" |
| | | #define OBSPolicyActionListMultipartUploadParts_OBS @"ListMultipartUploadParts" |
| | | #define OBSPolicyActionAbortMultipartUpload_OBS @"AbortMultipartUpload" |
| | | #define OBSPolicyActionRestoreObject_OBS @"RestoreObject" |
| | | #define OBSPolicyActionDeleteObject_OBS @"DeleteObject" |
| | | #define OBSPolicyActionReplicateObject_OBS @"ReplicateObject" |
| | | #define OBSPolicyActionReplicateDelete_OBS @"ReplicateDelete" |
| | | |
| | | |
| | | |
| | | #endif /* OBSServiceDefinition_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSCredentialProvider_h |
| | | #define OBSCredentialProvider_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @protocol OBSServiceCredentialProvider <OBSNetworkingRequestPostProcessor> |
| | | |
| | | @required |
| | | @property (nonatomic, strong, nonnull) NSString *accessKey; |
| | | @property (nonatomic, strong, nonnull) NSString *secretKey; |
| | | |
| | | @optional |
| | | @property (nonatomic, strong, nonnull) NSString *stsToken; |
| | | @property (nonatomic, strong, nonnull) NSDate *expiration; |
| | | @property (nonatomic, assign) OBSProtocolType protocolType; |
| | | |
| | | - (void)refresh; |
| | | @end |
| | | |
| | | |
| | | @interface OBSStaticCredentialProvider : NSObject <OBSServiceCredentialProvider> |
| | | |
| | | @property (nonatomic, strong, nonnull) NSString *accessKey; |
| | | @property (nonatomic, strong, nonnull) NSString *secretKey; |
| | | @property (nonatomic, assign) OBSAuthVersion authVersion; |
| | | @property (nonatomic, assign) OBSProtocolType protocolType; |
| | | @property (nonatomic, strong, nonnull) NSString *securityToken; |
| | | @property (nonatomic,assign) BOOL isGetProtocol; |
| | | |
| | | /** |
| | | 使用AccessKey初始化凭证 默认采用V2鉴权 |
| | | |
| | | @param accessKey 云服务控制台提供的accessKey |
| | | @param secretKey 云服务控制台提供的secreKey |
| | | @return 初始化完成的对象 |
| | | */ |
| | | - (instancetype)initWithAccessKey:(NSString *)accessKey secretKey:(NSString *)secretKey; |
| | | |
| | | /** |
| | | 使用AccessKey初始化凭证 |
| | | |
| | | @param accessKey 云服务控制台提供的accessKey |
| | | @param secretKey 云服务控制台提供的secreKey |
| | | @param authVersion 鉴权版本(OBSAuthVersionV2 OBSAuthVersionV4) |
| | | @return 初始化完成的对象 |
| | | */ |
| | | - (instancetype)initWithAccessKey:(NSString *)accessKey secretKey:(NSString *)secretKey authVersion:(OBSAuthVersion) authVersion; |
| | | @end |
| | | |
| | | @interface OBSSTSCredentialProvider : NSObject <OBSServiceCredentialProvider> |
| | | @property (nonatomic, strong, nonnull) NSString *accessKey; |
| | | @property (nonatomic, strong, nonnull) NSString *secretKey; |
| | | @property (nonatomic, assign) OBSAuthVersion authVersion; |
| | | @property (nonatomic, strong, nonnull) NSString *stsToken; |
| | | |
| | | |
| | | /** |
| | | 临时访问凭证初始化 默认采用V4鉴权 |
| | | |
| | | @param accessKey 临时访问密钥中的accessKey |
| | | @param secretKey 临时访问密钥中的secreKey |
| | | @param stsToken 安全令牌 |
| | | @return 初始化完成的对象 |
| | | */ |
| | | - (instancetype)initWithAccessKey:(NSString *)accessKey secretKey:(NSString *)secretKey stsToken:(NSString *)stsToken; |
| | | |
| | | |
| | | /** |
| | | 临时访问凭证初始化 |
| | | |
| | | @param accessKey 临时访问密钥中的accessKey |
| | | @param secretKey 临时访问密钥中的secreKey |
| | | @param stsToken 安全令牌 |
| | | @param authVersion 鉴权版本(OBSAuthVersionV2 OBSAuthVersionV4) |
| | | @return 初始化完成的对象 |
| | | */ |
| | | - (instancetype)initWithAccessKey:(NSString *)accessKey |
| | | secretKey:(NSString *)secretKey |
| | | stsToken:(NSString *)stsToken |
| | | authVersion:(OBSAuthVersion) authVersion; |
| | | @end |
| | | |
| | | NSArray *GetCanonicalHeadersKey(NSDictionary *headers, NSArray *additionalKeys,BOOL isOBSProtocol); |
| | | |
| | | NSString *GetCanonicalHeaderString(NSDictionary *headers ,NSArray *keyArray); |
| | | |
| | | NSString *V4GetSignedHeaderString(NSDictionary *headers, NSArray *keyArray); |
| | | |
| | | #endif /* OBSCredentialProvider_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSServiceInternalCommonEntities_h |
| | | #define OBSServiceInternalCommonEntities_h |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | @interface OBSCopyEncryptionTypeKMS: OBSAbstractEncryption |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryption; |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionAwsKmsKeyID; |
| | | @end |
| | | |
| | | |
| | | @interface OBSCopyEncryptionTypeCustomer: OBSAbstractEncryption |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerAlgorithm; |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerKey; |
| | | @property (nonatomic, strong, nonnull) NSString *serverSideEncryptionCustomerMD5; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSServiceInternalCommonEntities_h */ |
New file |
| | |
| | | // |
| | | // OBSServiceUtils.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 07/11/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSServiceUtils_h |
| | | #define OBSServiceUtils_h |
| | | #import "CommonCrypto/CommonHMAC.h" |
| | | #import "OBSUtils.h" |
| | | @interface OBSUtils(obsservice) |
| | | + (NSString *)calBase64md5FromData:(NSData*) data; |
| | | + (NSData *)sha256Hash:(NSData *)data; |
| | | + (NSData *)sha256HashString:(NSString*)string; |
| | | + (NSString *)hexEncode:(NSString*)string; |
| | | + (NSData*)hmacWithData:(NSData*) data withKeyData:(NSData*) key algorithm:(CCHmacAlgorithm)algorithm; |
| | | + (NSData*)hmacWithString:(NSString*) string withKeyString:(NSString*) key algorithm:(CCHmacAlgorithm)algorithm; |
| | | + (NSData*)hmacWithString:(NSString*) string withKeyData:(NSData*) key algorithm:(CCHmacAlgorithm)algorithm; |
| | | + (NSData*)sha256HmacWithData:(NSData*) data withKeyData:(NSData*) key; |
| | | + (NSData*)sha256HmacWithString:(NSString*) string withKeyString:(NSString*) key; |
| | | + (NSData*)sha256HmacWithString:(NSString*) string withKeyData:(NSData*) key; |
| | | + (NSDate*)dateFromString:(NSString*)string format:(NSString*) dateFormat; |
| | | |
| | | +(NSDictionary*)getOBSTrueFalseDict; |
| | | +(NSDictionary*)getOBSACLPolicyDict; |
| | | +(NSDictionary*)getOBSACLDict; |
| | | +(NSDictionary*)getOBSStorageClassDict; |
| | | +(NSDictionary*)getOBSContetnTypeDict; |
| | | +(NSDictionary*)getOBSContentType; |
| | | +(NSDictionary*)getOBSVersioningStatusDict; |
| | | +(NSDictionary*)getOBSBucketLifecycleStatusDict; |
| | | +(NSDictionary*)getOBSPolicyEffectDict; |
| | | +(NSDictionary*)getOBSMetaDataDirectiveDict; |
| | | +(NSDictionary*)getOBSRestoreTierDict; |
| | | +(NSDictionary*)getOBSReplicateStatusDict; |
| | | |
| | | |
| | | +(NSArray*)getOBSCORSAllowedMethodArray; |
| | | |
| | | +(NSArray*)convertDictToArray:(NSDictionary *)dict orderAray:(NSArray*)orderArray; |
| | | |
| | | +(__kindof OBSBaseNetworkingRequest*)convertOBSClientRequestToNetworkingRequestWithMTL:(OBSBaseRequest*) obsRequest |
| | | configuration:(OBSBaseConfiguration*) configruation |
| | | targetClazz:(Class) targetClazz error:(NSError**) error; |
| | | @end |
| | | |
| | | #endif /* OBSServiceUtils_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketACLModel_h |
| | | #define OBSSetBucketACLModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶访问策略 |
| | | */ |
| | | @protocol OBSSetBucketACLProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 直接设置桶访问策略request |
| | | */ |
| | | @interface OBSSetBucketACLWithPolicyRequest: OBSBaseRequest<OBSSetBucketACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 访问控制权限策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSAccessControlPolicy *accessControlPolicy; |
| | | |
| | | /** |
| | | 初始化直接设置桶访问策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @param accessControlPolicy 访问控制权限策略对象 |
| | | @return 设置桶ACL的request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName accessControlPolicy:(OBSAccessControlPolicy*) accessControlPolicy; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 预定义设置桶访问策略 |
| | | */ |
| | | @interface OBSSetBucketACLWithCannedACLRequest: OBSBaseRequest<OBSSetBucketACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | ACL种类 |
| | | |
| | | OBSACLPolicyPrivate 桶或对象的所有者拥有完全控制的权限,其他任何人都没有访问权限, |
| | | OBSACLPolicyPublicRead 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读的权限, |
| | | OBSACLPolicyPublicReadWrite 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读和写的权限, |
| | | OBSACLPolicyAuthenticatedRead 桶或对象的所有者拥有完全控制的权限,其他OBS授权用户拥有读权限, |
| | | OBSACLPolicyBucketOwnerRead 对象的所有者拥有完全控制的权限,桶的所有者拥有只读的权限, |
| | | OBSACLPolicyBucketOwnerFullControl 对象的所有者拥有完全控制的权限,桶的所有者拥有完全控制的权限, |
| | | OBSACLPolicyLogDeliveryWrite 日志投递用户组拥有对桶的写权限以及读 ACP的权限, |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy cannedACL; |
| | | |
| | | /** |
| | | 初始化预定义设置桶访问策略 request |
| | | |
| | | @param bucketName 桶名 |
| | | @param cannedACL 预定义策略对象 |
| | | @return 预定义设置桶策略 request |
| | | |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName cannedACL:(OBSACLPolicy) cannedACL; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketACLRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶访问策略response |
| | | */ |
| | | @interface OBSSetBucketACLResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketACL) |
| | | |
| | | /** |
| | | 设置桶访问策略 |
| | | |
| | | @param request 设置桶访问策略request |
| | | @param completionHandler 设置桶访问策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketACL:(__kindof OBSBaseRequest<OBSSetBucketACLProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketACLResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketACLModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketCORSModel_h |
| | | #define OBSSetBucketCORSModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 跨域资源共享设置 |
| | | */ |
| | | @protocol OBSSetBucketCORSProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 跨域资源共享设置规则列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSCORSRule*> *bucketCORSRuleList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 跨域资源共享设置请求 |
| | | */ |
| | | @interface OBSSetBucketCORSRequest: OBSBaseRequest<OBSSetBucketCORSProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | cors配置列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSCORSRule*> *bucketCORSRuleList; |
| | | |
| | | /** |
| | | 初始化跨域资源共享request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 跨域资源共享request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketCORSRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶CORS response |
| | | */ |
| | | @interface OBSSetBucketCORSResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketCORS) |
| | | |
| | | /** |
| | | 设置CORS |
| | | |
| | | @param request 设置桶CORS request |
| | | @param completionHandler 设置CORS回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)setBucketCORS:(__kindof OBSBaseRequest<OBSSetBucketCORSProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketCORSResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketCORSModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketLifecycleModel_h |
| | | #define OBSSetBucketLifecycleModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶生命周期 |
| | | */ |
| | | @protocol OBSSetBucketLifecycleProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶生命周期request |
| | | */ |
| | | @interface OBSSetBucketLifecycleRequest: OBSBaseRequest<OBSSetBucketLifecycleProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 生命周期配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLifecycleRule*> *lifecycleRuleList; |
| | | |
| | | /** |
| | | 初始化设置桶生命周期request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 设置桶生命周期request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName ; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketLifecycleRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶生命周期response |
| | | */ |
| | | @interface OBSSetBucketLifecycleResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketLifecycle) |
| | | |
| | | /** |
| | | 设置桶的生命周期 |
| | | |
| | | @param request 设置桶生命期request |
| | | @param completionHandler 设置桶生命周期回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketLifecycle:(__kindof OBSBaseRequest<OBSSetBucketLifecycleProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketLifecycleResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSSetBucketLifecycleModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketLoggingModel_h |
| | | #define OBSSetBucketLoggingModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | /** |
| | | 设置桶日志 |
| | | */ |
| | | @protocol OBSSetBucketLoggingProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | |
| | | /** |
| | | 设置桶日志request |
| | | */ |
| | | @interface OBSSetBucketLoggingRequest: OBSBaseRequest<OBSSetBucketLoggingProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | |
| | | |
| | | /** |
| | | 日志配置数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSLoggingEnabled*> *loggingEnabledList; |
| | | |
| | | /** |
| | | 初始化设置桶日志request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 设置桶日志request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | |
| | | |
| | | @interface OBSSetBucketLoggingRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶日志response |
| | | */ |
| | | @interface OBSSetBucketLoggingResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketLogging) |
| | | |
| | | /** |
| | | 设置桶日志 |
| | | |
| | | @param request 设置桶日志request |
| | | @param completionHandler 设置桶日志回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketLogging:(__kindof OBSBaseRequest<OBSSetBucketLoggingProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketLoggingResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketLoggingModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketNotificationModel_h |
| | | #define OBSSetBucketNotificationModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶的消息通知 |
| | | */ |
| | | @protocol OBSSetBucketNotificationProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 配置列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSNotificationTopicConfiguration*> *configurationList; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶的消息通知配置request |
| | | */ |
| | | @interface OBSSetBucketNotificationRequest: OBSBaseRequest<OBSSetBucketNotificationProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 配置列表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSNotificationTopicConfiguration*> *configurationList; |
| | | |
| | | /** |
| | | 初始化设置桶的消息通知配置request |
| | | |
| | | @param bucketName 桶名 |
| | | @return request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketNotificationRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶的消息通知配置response |
| | | */ |
| | | @interface OBSSetBucketNotificationResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketNotification) |
| | | |
| | | /** |
| | | 设置桶的消息通知配置 |
| | | |
| | | @param request 设置桶的消息通知配置request |
| | | @param completionHandler 设置桶的消息通知回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketNotification:(__kindof OBSBaseRequest<OBSSetBucketNotificationProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketNotificationResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketNotificationModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketPolicyModel_h |
| | | #define OBSSetBucketPolicyModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶策略 |
| | | */ |
| | | @protocol OBSSetBucketPolicyProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 使用字符串设置桶策略request |
| | | */ |
| | | @interface OBSSetBucketPolicyWithStringRequest: OBSBaseRequest<OBSSetBucketPolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶策略字符串 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *policyString; |
| | | |
| | | /** |
| | | 初始化字符串设置桶策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @param policyString 策略字符串 |
| | | @return 字符串设置桶策略request对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName policyString:(NSString*) policyString; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶策略request |
| | | */ |
| | | @interface OBSSetBucketPolicyRequest: OBSBaseRequest<OBSSetBucketPolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶策略版本 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString* policyVersion; |
| | | |
| | | /** |
| | | 策略声明数组 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSPolicyStatement*> *statementList; |
| | | |
| | | /** |
| | | 初始化设置桶策略request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 设置桶策略request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketPolicyRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | @interface OBSSetBucketPolicyWithStringRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶策略response |
| | | */ |
| | | @interface OBSSetBucketPolicyResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketPolicy) |
| | | |
| | | /** |
| | | 设置桶策略 |
| | | |
| | | @param request 设置桶策略request对象 |
| | | @param completionHandler 设置桶策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketPolicy:(__kindof OBSBaseRequest<OBSSetBucketPolicyProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketPolicyResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketPolicyModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketQuotaModel_h |
| | | #define OBSSetBucketQuotaModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - entity |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶配额 |
| | | */ |
| | | @protocol OBSSetBucketQuotaProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶配额 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSQuota *quota; |
| | | @end |
| | | |
| | | |
| | | |
| | | /** |
| | | 设置桶配额 |
| | | */ |
| | | @interface OBSSetBucketQuotaRequest: OBSBaseRequest<OBSSetBucketQuotaProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶配额 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSQuota *quota; |
| | | |
| | | /** |
| | | 初始化设置桶配额request |
| | | |
| | | @param bucketName 桶名 |
| | | @param quota 桶容量对象 |
| | | @return 设置桶配额request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName quota:(OBSQuota*)quota; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketQuotaRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶配额response |
| | | */ |
| | | @interface OBSSetBucketQuotaResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketQuota) |
| | | |
| | | /** |
| | | 设置桶配额 |
| | | |
| | | @param request 设置桶配额request对象 |
| | | @param completionHandler 设置桶配额回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketQuota:(__kindof OBSBaseRequest<OBSSetBucketQuotaProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketQuotaResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketQuotaModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketStoragePolicyModel_h |
| | | #define OBSSetBucketStoragePolicyModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - request entity |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶存储策略 |
| | | */ |
| | | @protocol OBSSetBucketStoragePolicyProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 存储策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSStoragePolicy* storagePolicy; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶存储策略 |
| | | */ |
| | | @interface OBSSetBucketStoragePolicyRequest: OBSBaseRequest<OBSSetBucketStoragePolicyProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 存储策略 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSStoragePolicy* storagePolicy; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | 设置桶存储策略request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @param storagePolicy 存储策略 |
| | | @return 桶存储策略对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName storagePolicy:(OBSStoragePolicy*) storagePolicy; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketStoragePolicyRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶存储策略response |
| | | */ |
| | | @interface OBSSetBucketStoragePolicyResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketStoragePolicy) |
| | | |
| | | /** |
| | | 设置桶存储策略 |
| | | |
| | | @param request 桶存储策略request对象 |
| | | @param completionHandler 设置桶存储策略回调 |
| | | @return task |
| | | */ |
| | | - (OBSBFTask*)setBucketStoragePolicy:(__kindof OBSBaseRequest<OBSSetBucketStoragePolicyProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketStoragePolicyResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketStoragePolicyModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketTaggingModel_h |
| | | #define OBSSetBucketTaggingModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶标签 |
| | | */ |
| | | @protocol OBSSetBucketTaggingProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置桶标签request |
| | | */ |
| | | @interface OBSSetBucketTaggingRequest: OBSBaseRequest<OBSSetBucketTaggingProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 标签表 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSMutableArray<OBSBucketTag*> *tagList; |
| | | |
| | | /** |
| | | 初始化设置桶标签request |
| | | |
| | | @param bucketName 桶名 |
| | | @return 设置桶标签request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketTaggingRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶标签response |
| | | */ |
| | | @interface OBSSetBucketTaggingResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketTagging) |
| | | |
| | | /** |
| | | 设置桶标签 |
| | | |
| | | @param request 设置桶标签request |
| | | @param completionHandler 设置桶标签回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketTagging:(__kindof OBSBaseRequest<OBSSetBucketTaggingProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketTaggingResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketTaggingModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketVersioningModel_h |
| | | #define OBSSetBucketVersioningModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | #pragma mark - entities |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置桶多版本 |
| | | */ |
| | | @protocol OBSSetBucketVersioningProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶多版本配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSBucketVersioningConfiguration *configuration; |
| | | @end |
| | | |
| | | /** |
| | | 设置桶多版本 request |
| | | */ |
| | | @interface OBSSetBucketVersioningRequest: OBSBaseRequest<OBSSetBucketVersioningProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶多版本配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSBucketVersioningConfiguration *configuration; |
| | | |
| | | /** |
| | | 设置桶多版本request初始化 |
| | | |
| | | @param bucketName 桶名 |
| | | @param configuration 桶多版本配置 |
| | | @return 桶多版本请求对象 |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName configuration:(OBSBucketVersioningConfiguration *) configuration; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketVersioningRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶多版本response |
| | | */ |
| | | @interface OBSSetBucketVersioningResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketVersioning) |
| | | |
| | | /** |
| | | 桶多版本设置 |
| | | |
| | | @param request 桶多版本request对象 |
| | | @param completionHandler 桶多版本回调 |
| | | @return task对象 |
| | | */ |
| | | - (OBSBFTask*)setBucketVersioning:(__kindof OBSBaseRequest<OBSSetBucketVersioningProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketVersioningResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSSetBucketVersioningModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetBucketWebsiteModel_h |
| | | #define OBSSetBucketWebsiteModel_h |
| | | |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 静态网站托管 |
| | | */ |
| | | @protocol OBSSetBucketWebsiteProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 静态网站托管 |
| | | */ |
| | | @interface OBSSetBucketWebsiteRequest: OBSBaseRequest<OBSSetBucketWebsiteProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 桶托管配置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractWebsiteConf *configuration; |
| | | |
| | | /** |
| | | 初始化设置静态网站托管request |
| | | |
| | | @param bucketName 桶名 |
| | | @param configuration 桶托管配置 |
| | | @return 设置桶的网站配置request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName configuration:(__kindof OBSAbstractWebsiteConf*) configuration; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetBucketWebsiteRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置桶托管配置response |
| | | */ |
| | | @interface OBSSetBucketWebsiteResponse: OBSServiceResponse |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setBucketWebsite) |
| | | |
| | | /** |
| | | 设置桶静态网站托管 |
| | | |
| | | @param request 设置桶的网站配置request |
| | | @param completionHandler 设置桶静态网站托管回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setBucketWebsite:(__kindof OBSBaseRequest<OBSSetBucketWebsiteProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetBucketWebsiteResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | #endif /* OBSSetBucketWebsiteModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSSetObjectACLModel_h |
| | | #define OBSSetObjectACLModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceCommonEntities.h" |
| | | |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 设置对象访问策略 |
| | | */ |
| | | @protocol OBSSetObjectACLProtocol |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 访问策略 |
| | | */ |
| | | //@property (nonatomic, strong, nonnull) OBSAccessControlPolicy *accessControlPolicy; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 设置对象访问策略request |
| | | */ |
| | | @interface OBSSetObjectACLRequest: OBSBaseRequest<OBSSetObjectACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | 访问权限控制 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) OBSAccessControlPolicy *accessControlPolicy; |
| | | |
| | | /** |
| | | 初始化设置对象访问策略 request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象key |
| | | @param accessControlPolicy 访问权限控制 |
| | | @return 设置对象访问策略 request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey accessControlPolicy:(OBSAccessControlPolicy*) accessControlPolicy; |
| | | @end |
| | | |
| | | /** |
| | | 预定义头域设置桶访问策略 //**添加了以头域方式对已存在对象设置ACL的方式 |
| | | */ |
| | | @interface OBSSetObjectACLWithCannedACLRequest: OBSBaseRequest<OBSSetObjectACLProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象多版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | |
| | | /** |
| | | ACL种类 |
| | | |
| | | OBSACLPolicyPrivate 桶或对象的所有者拥有完全控制的权限,其他任何人都没有访问权限, |
| | | OBSACLPolicyPublicRead 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读的权限, |
| | | OBSACLPolicyPublicReadWrite 桶或对象的所有者拥有完全控制的权限,其他所有用户包括匿名用户拥有读和写的权限, |
| | | OBSACLPolicyAuthenticatedRead 桶或对象的所有者拥有完全控制的权限,其他OBS授权用户拥有读权限, |
| | | OBSACLPolicyBucketOwnerRead 对象的所有者拥有完全控制的权限,桶的所有者拥有只读的权限, |
| | | OBSACLPolicyBucketOwnerFullControl 对象的所有者拥有完全控制的权限,桶的所有者拥有完全控制的权限, |
| | | OBSACLPolicyLogDeliveryWrite 日志投递用户组拥有对桶的写权限以及读 ACP的权限, |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy cannedACL; |
| | | |
| | | /** |
| | | 初始化预定义设置桶访问策略 request |
| | | |
| | | @param bucketName 桶名 |
| | | @param cannedACL 预定义策略对象 |
| | | @return 预定义设置桶策略 request |
| | | |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey cannedACL:(OBSACLPolicy) cannedACL; |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSSetObjectACLRequestNetworking : OBSServiceNetworkingCommandRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 设置对象访问策略response |
| | | */ |
| | | @interface OBSSetObjectACLResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 版本ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *versionID; |
| | | @end |
| | | |
| | | |
| | | #pragma mark - client method |
| | | @interface OBSClient(setObjectACL) |
| | | |
| | | /** |
| | | 设置对象的ACL |
| | | |
| | | @param request 设置对象访问策略 request |
| | | @param completionHandler 设置对象访问策略回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)setObjectACL:(__kindof OBSBaseRequest<OBSSetObjectACLProtocol>*)request |
| | | completionHandler:(void (^)(OBSSetObjectACLResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | |
| | | #endif /* OBSSetObjectACLModel_h */ |
New file |
| | |
| | | // |
| | | // OBSUploadFileModel.h |
| | | // OBS |
| | | // |
| | | // Created by MaxZhang on 11/12/2017. |
| | | // Copyright © 2017 obs. All rights reserved. |
| | | // |
| | | |
| | | #ifndef OBSUploadFileModel_h |
| | | #define OBSUploadFileModel_h |
| | | #import "OBSBaseModel.h" |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | @class OBSAbstractEncryption; |
| | | |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 断点续传 |
| | | */ |
| | | @protocol OBSUploadFileProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 访问策略 |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 存储类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 重定向站点 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传文件地址 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | |
| | | /** |
| | | 上传进度 |
| | | */ |
| | | @property (atomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | |
| | | /** |
| | | 开启断点续传 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableCheckpoint; |
| | | |
| | | /** |
| | | 开启MD5校验 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableMD5Check; |
| | | |
| | | /** |
| | | 开启分段MD5校验 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enablePartMD5Check; |
| | | |
| | | /** |
| | | 设置断点续传模式下,记录上传进度的文件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *checkpointFilePath; |
| | | |
| | | /** |
| | | 分段大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partSize; |
| | | |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 断点续传request |
| | | */ |
| | | @interface OBSUploadFileRequest: OBSBaseRequest<OBSUploadFileProtocol> |
| | | |
| | | /** |
| | | 上传数据 |
| | | */ |
| | | @property (nonatomic, strong) NSData *uploadAllData; |
| | | |
| | | @property (nonatomic, strong) NSFileHandle *fileHandle; |
| | | /** |
| | | 上传路径,避免多次重新读取数据映射造成内存问题 |
| | | */ |
| | | @property (nonatomic, strong) NSString *lastUploadFilePath; |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象key |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 对象ACL |
| | | */ |
| | | @property (nonatomic, assign) OBSACLPolicy objectACLPolicy; |
| | | |
| | | /** |
| | | 存储模式 |
| | | */ |
| | | @property (nonatomic, assign) OBSStorageClass storageClass; |
| | | |
| | | /** |
| | | 元数据 |
| | | */ |
| | | @property (nonatomic, strong, nullable) NSDictionary *metaDataDict; |
| | | |
| | | /** |
| | | 网址重定向 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *websiteRedirectLocation; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | |
| | | /** |
| | | 上传回调 |
| | | */ |
| | | @property (atomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | |
| | | /** |
| | | 是否支持断点续传 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableCheckpoint; |
| | | |
| | | /** |
| | | 文件MD5校验 |
| | | */ |
| | | @property (nonatomic, assign) BOOL enableMD5Check; |
| | | |
| | | /** |
| | | 设置断点续传模式下,记录上传进度的文件 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *checkpointFilePath; |
| | | |
| | | /** |
| | | 分段大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partSize; |
| | | |
| | | /** |
| | | MIME类型 |
| | | */ |
| | | @property (nonatomic, assign) OBSContentType contentType; |
| | | |
| | | /** |
| | | 自定义MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *customContentType; |
| | | |
| | | /** |
| | | 最终映射MIME类型 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *finalContentType; |
| | | |
| | | /** |
| | | 初始化断点续传request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectKey 对象key |
| | | @param uploadFilePath 上传文件路径 |
| | | @return 断点续传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName objectKey:(NSString*) objectKey uploadFilePath:(NSString*) uploadFilePath; |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 断点续传response |
| | | */ |
| | | @interface OBSUploadFileResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 上传对象etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(uploadFile) |
| | | |
| | | /** |
| | | 上传文件 |
| | | |
| | | @param request 断点续传request |
| | | @param completionHandler 断点续传回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)uploadFile:(__kindof OBSBaseRequest<OBSUploadFileProtocol>*)request |
| | | completionHandler:(void (^)(OBSUploadFileResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSUploadFileModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSUploadPartModel_h |
| | | #define OBSUploadPartModel_h |
| | | #import "OBSBaseNetworking.h" |
| | | #import "OBSClient.h" |
| | | #import "OBSServiceBaseModel.h" |
| | | #import "OBSServiceConstDefinition.h" |
| | | |
| | | @class OBSAbstractEncryption; |
| | | //request |
| | | #pragma mark - request |
| | | |
| | | /** |
| | | 多段数据上传 |
| | | */ |
| | | @protocol OBSUploadPartProtocol<NSObject> |
| | | @required |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 分段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumber; // 1 to 10000 |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传进度 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 多段上传父类 |
| | | */ |
| | | @interface OBSAbstractUploadPartRequest : OBSBaseRequest<OBSUploadPartProtocol> |
| | | |
| | | /** |
| | | 桶名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *bucketName; |
| | | |
| | | /** |
| | | 对象名 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *objectKey; |
| | | |
| | | /** |
| | | 分段号 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *partNumber; // 1 to 10000 |
| | | |
| | | /** |
| | | 多段上传任务ID |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadID; |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传进度 |
| | | */ |
| | | @property (nonatomic, copy, nonnull) OBSNetworkingUploadProgressBlock uploadProgressBlock; |
| | | |
| | | /** |
| | | Content-MD5 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *contentMD5; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 多段数据上传request |
| | | */ |
| | | @interface OBSUploadPartWithDataRequest: OBSAbstractUploadPartRequest |
| | | |
| | | /** |
| | | 上传的数据 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSData *uploadData; |
| | | |
| | | - (void) freeUploadData; |
| | | /** |
| | | 初始化多段数据上传request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectkey 对象KEY |
| | | @param partNumber 上传段的段号 |
| | | @param uploadID 多段上传任务ID |
| | | @param data 上传的数据 |
| | | @return 多段数据上传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectkey:(NSString*) objectkey |
| | | partNumber:(NSNumber*) partNumber |
| | | uploadID:(NSString*) uploadID |
| | | uploadData:(NSData*) data; |
| | | |
| | | /** |
| | | 初始化多段数据上传request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectkey 对象KEY |
| | | @param partNumber 上传段的段号 |
| | | @param uploadID 多段上传任务ID |
| | | @param data 上传的数据URL |
| | | @return 多段数据上传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectkey:(NSString*) objectkey |
| | | partNumber:(NSNumber*) partNumber |
| | | uploadID:(NSString*) uploadID |
| | | uploadDataURL:(NSURL*) dataURL; |
| | | @end |
| | | |
| | | |
| | | /** |
| | | 多段文件上传request |
| | | */ |
| | | @interface OBSUploadPartWithFileRequest: OBSAbstractUploadPartRequest |
| | | /** |
| | | 上传数据 |
| | | */ |
| | | @property (nonatomic, weak) __weak NSData *uploadAllData; |
| | | @property (nonatomic, weak) __weak NSFileHandle *fileHandle; |
| | | |
| | | /** |
| | | 文件路径 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *uploadFilePath; |
| | | |
| | | /** |
| | | 开始的位置 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *bytesStart; |
| | | |
| | | /** |
| | | 数据大小 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSNumber *bytesLength; |
| | | |
| | | /** |
| | | 是否后台上传 |
| | | */ |
| | | @property (nonatomic, assign) BOOL background; |
| | | |
| | | @property (nonatomic, strong) OBSUploadPartWithDataRequest * dataRequest; |
| | | |
| | | |
| | | @property (nonatomic, strong) OBSBaseNetworkingRequest * dataRequest1; |
| | | |
| | | |
| | | /** |
| | | 初始化多段文件上传request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectkey 对象KEY |
| | | @param partNumber 上传段的段号 |
| | | @param uploadID 多段上传任务ID |
| | | @param uploadFilePath 文件路径 |
| | | @return 多段文件上传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectkey:(NSString*) objectkey |
| | | partNumber:(NSNumber*) partNumber |
| | | uploadID:(NSString*) uploadID |
| | | uploadFilePath:(NSString*) uploadFilePath; |
| | | |
| | | /** |
| | | 初始化多段文件上传request |
| | | |
| | | @param bucketName 桶名 |
| | | @param objectkey 对象KEY |
| | | @param partNumber 上传段的段号 |
| | | @param uploadID 多段上传任务ID |
| | | @param uploadFilePath 文件路径 |
| | | @param bytestStart 开始位置 |
| | | @param bytestLength 文件大小 |
| | | @return 多段文件上传request |
| | | */ |
| | | -(instancetype)initWithBucketName:(NSString*) bucketName |
| | | objectkey:(NSString*) objectkey |
| | | partNumber:(NSNumber*) partNumber |
| | | uploadID:(NSString*) uploadID |
| | | uploadFilePath:(NSString*) uploadFilePath |
| | | bytesStart:(NSNumber*) bytestStart // long |
| | | bytesLength:(NSNumber*) bytestLength; //long |
| | | @end |
| | | |
| | | #pragma mark - networking request |
| | | @interface OBSNetworkingUploadPartWithDataRequest : OBSServiceNetworkingUploadDataRequest |
| | | @end |
| | | |
| | | @interface OBSNetworkingUploadPartWithFileRequest : OBSServiceNetworkingUploadFileRequest |
| | | @end |
| | | |
| | | //response |
| | | #pragma mark - response |
| | | |
| | | /** |
| | | 多段上传response |
| | | */ |
| | | @interface OBSUploadPartResponse: OBSServiceResponse |
| | | |
| | | /** |
| | | 加密方式 |
| | | */ |
| | | @property (nonatomic, strong, nonnull) __kindof OBSAbstractEncryption *encryption; |
| | | |
| | | /** |
| | | 上传段的etag |
| | | */ |
| | | @property (nonatomic, strong, nonnull) NSString *etag; |
| | | @end |
| | | |
| | | //client method |
| | | #pragma mark - client method |
| | | @interface OBSClient(uploadPart) |
| | | |
| | | /** |
| | | 多段上传 |
| | | |
| | | @param request 多段上传request |
| | | @param completionHandler 多段上传回调 |
| | | @return OBSBFTask |
| | | */ |
| | | - (OBSBFTask*)uploadPart:(__kindof OBSBaseRequest<OBSUploadPartProtocol>*)request |
| | | completionHandler:(void (^)(OBSUploadPartResponse * response, NSError * error))completionHandler; |
| | | @end |
| | | |
| | | #endif /* OBSUploadPartModel_h */ |
New file |
| | |
| | | // Copyright 2019 Huawei Technologies Co.,Ltd. |
| | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use |
| | | // this file except in compliance with the License. You may obtain a copy of the |
| | | // License at |
| | | // |
| | | // http://www.apache.org/licenses/LICENSE-2.0 |
| | | // |
| | | // Unless required by applicable law or agreed to in writing, software distributed |
| | | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| | | // CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| | | // specific language governing permissions and limitations under the License. |
| | | |
| | | #ifndef OBSUtils_h |
| | | #define OBSUtils_h |
| | | @class OBSBaseRequest; |
| | | @class OBSBaseNetworkingRequest; |
| | | @class OBSBaseConfiguration; |
| | | @class OBSServiceNetworkingRequest; |
| | | |
| | | @interface OBSUtils : NSObject |
| | | //+ (NSDictionary*)convertXMLStringToDict:(NSString*) xmlString error:(NSError**) error; |
| | | + (NSDictionary*)convertXMLDataToDict:(NSData*) xmlData error:(NSError**) error; |
| | | + (NSString*)convertDictToXMLString:(NSDictionary*) dict error:(NSError**) error; |
| | | |
| | | +(__kindof OBSBaseNetworkingRequest*)convertOBSRequestToNetworkingRequestWithMTL:(OBSBaseRequest*) obsRequest |
| | | configuration:(OBSBaseConfiguration*) configruation |
| | | targetClazz:(Class) targetClazz |
| | | error:(NSError**) error; |
| | | |
| | | +(NSMutableDictionary*)getDataDict:(OBSBaseRequest*) obsRequest |
| | | configuration:(OBSBaseConfiguration*) configuration |
| | | targetClazz:(Class) targetClazz |
| | | error:(NSError**) error; |
| | | |
| | | +(OBSBaseNetworkingRequest*)getNetworkingRequestFromDict:(Class) networkingClazz |
| | | dataDict:(NSDictionary*) dataDict |
| | | configuration:(OBSBaseConfiguration*) configuration |
| | | error:(NSError**) error; |
| | | |
| | | +(NSString*)generateQueryString:(NSDictionary*) queryParameters; |
| | | +(NSString*)V4PresignGenerateQueryString:(NSDictionary*) queryParameters; |
| | | |
| | | + (NSDateFormatter *)getDateFormatterRFC1123; |
| | | + (NSDateFormatter *)getDateFormatterISO8601Format3; |
| | | + (NSString *)getDateStringWithFormatString:(NSDate*) date format:(NSString*) dateFormat; |
| | | |
| | | // 新增CDN自定义域名处理函数 |
| | | + (NSString *)v2CDNCustomDomain:(OBSServiceNetworkingRequest*) request; |
| | | + (void)v4CDNCustomDomain:(OBSServiceNetworkingRequest*) request; |
| | | @end |
| | | |
| | | #endif /* OBSUtils_h */ |
New file |
| | |
| | | //
|
| | | // OBSXMLDictionary.h
|
| | | //
|
| | | // Version 1.4.1
|
| | | //
|
| | | // Created by Nick Lockwood on 15/11/2010.
|
| | | // Copyright 2010 Charcoal Design. All rights reserved.
|
| | | //
|
| | | // Get the latest version of OBSXMLDictionary from here:
|
| | | //
|
| | | // https://github.com/nicklockwood/XMLDictionary
|
| | | //
|
| | | // This software is provided 'as-is', without any express or implied
|
| | | // warranty. In no event will the authors be held liable for any damages
|
| | | // arising from the use of this software.
|
| | | //
|
| | | // Permission is granted to anyone to use this software for any purpose,
|
| | | // including commercial applications, and to alter it and redistribute it
|
| | | // freely, subject to the following restrictions:
|
| | | //
|
| | | // 1. The origin of this software must not be misrepresented; you must not
|
| | | // claim that you wrote the original software. If you use this software
|
| | | // in a product, an acknowledgment in the product documentation would be
|
| | | // appreciated but is not required.
|
| | | //
|
| | | // 2. Altered source versions must be plainly marked as such, and must not be
|
| | | // misrepresented as being the original software.
|
| | | //
|
| | | // 3. This notice may not be removed or altered from any source distribution.
|
| | | //
|
| | |
|
| | | #import <Foundation/Foundation.h>
|
| | | #pragma GCC diagnostic push
|
| | | #pragma GCC diagnostic ignored "-Wobjc-missing-property-synthesis"
|
| | |
|
| | |
|
| | | NS_ASSUME_NONNULL_BEGIN
|
| | |
|
| | | extern NSString *const OBSXMLDictionaryFrameworkVersionString;
|
| | |
|
| | | typedef NS_ENUM(NSInteger, OBSXMLDictionaryAttributesMode)
|
| | | {
|
| | | OBSXMLDictionaryAttributesModePrefixed = 0, //default
|
| | | OBSXMLDictionaryAttributesModeDictionary,
|
| | | OBSXMLDictionaryAttributesModeUnprefixed,
|
| | | OBSXMLDictionaryAttributesModeDiscard
|
| | | };
|
| | |
|
| | |
|
| | | typedef NS_ENUM(NSInteger, OBSXMLDictionaryNodeNameMode)
|
| | | {
|
| | | OBSXMLDictionaryNodeNameModeRootOnly = 0, //default
|
| | | OBSXMLDictionaryNodeNameModeAlways,
|
| | | OBSXMLDictionaryNodeNameModeNever
|
| | | };
|
| | |
|
| | |
|
| | | static NSString *const OBSXMLDictionaryAttributesKey = @"__attributes";
|
| | | static NSString *const OBSXMLDictionaryCommentsKey = @"__comments";
|
| | | static NSString *const OBSXMLDictionaryTextKey = @"__text";
|
| | | static NSString *const OBSXMLDictionaryNodeNameKey = @"__name";
|
| | | static NSString *const OBSXMLDictionaryAttributePrefix = @"_";
|
| | |
|
| | |
|
| | | @interface OBSXMLDictionaryParser : NSObject <NSCopying>
|
| | |
|
| | | + (OBSXMLDictionaryParser *)sharedInstance;
|
| | |
|
| | | @property (nonatomic, assign) BOOL collapseTextNodes; // defaults to YES
|
| | | @property (nonatomic, assign) BOOL stripEmptyNodes; // defaults to YES
|
| | | @property (nonatomic, assign) BOOL trimWhiteSpace; // defaults to YES
|
| | | @property (nonatomic, assign) BOOL alwaysUseArrays; // defaults to NO
|
| | | @property (nonatomic, assign) BOOL preserveComments; // defaults to NO
|
| | | @property (nonatomic, assign) BOOL wrapRootNode; // defaults to NO
|
| | |
|
| | | @property (nonatomic, assign) OBSXMLDictionaryAttributesMode attributesMode;
|
| | | @property (nonatomic, assign) OBSXMLDictionaryNodeNameMode nodeNameMode;
|
| | |
|
| | | - (nullable NSDictionary<NSString *, id> *)dictionaryWithParser:(NSXMLParser *)parser;
|
| | | - (nullable NSDictionary<NSString *, id> *)dictionaryWithData:(NSData *)data;
|
| | | - (nullable NSDictionary<NSString *, id> *)dictionaryWithString:(NSString *)string;
|
| | | - (nullable NSDictionary<NSString *, id> *)dictionaryWithFile:(NSString *)path;
|
| | |
|
| | | @end
|
| | |
|
| | |
|
| | | @interface NSDictionary (OBSXMLDictionary)
|
| | |
|
| | | + (nullable NSDictionary<NSString *, id> *)dictionaryWithOBSXMLParser:(NSXMLParser *)parser;
|
| | | + (nullable NSDictionary<NSString *, id> *)dictionaryWithOBSXMLData:(NSData *)data;
|
| | | + (nullable NSDictionary<NSString *, id> *)dictionaryWithOBSXMLString:(NSString *)string;
|
| | | + (nullable NSDictionary<NSString *, id> *)dictionaryWithOBSXMLFile:(NSString *)path;
|
| | |
|
| | | @property (nonatomic, readonly, copy, nullable) NSDictionary<NSString *, NSString *> *attributes;
|
| | | @property (nonatomic, readonly, copy, nullable) NSDictionary<NSString *, id> *childNodes;
|
| | | @property (nonatomic, readonly, copy, nullable) NSArray<NSString *> *comments;
|
| | | @property (nonatomic, readonly, copy, nullable) NSString *nodeName;
|
| | | @property (nonatomic, readonly, copy, nullable) NSString *innerText;
|
| | | @property (nonatomic, readonly, copy) NSString *innerOBSXML;
|
| | | @property (nonatomic, readonly, copy) NSString *OBSXMLString;
|
| | |
|
| | | - (nullable NSArray *)arrayValueForKeyPath:(NSString *)keyPath;
|
| | | - (nullable NSString *)stringValueForKeyPath:(NSString *)keyPath;
|
| | | - (nullable NSDictionary<NSString *, id> *)dictionaryValueForKeyPath:(NSString *)keyPath;
|
| | |
|
| | | @end
|
| | |
|
| | |
|
| | | @interface NSString (OBSXMLDictionary)
|
| | |
|
| | | @property (nonatomic, readonly, copy) NSString *OBSXMLEncodedString;
|
| | |
|
| | | @end
|
| | |
|
| | |
|
| | | NS_ASSUME_NONNULL_END
|
| | |
|
| | |
|
| | | #pragma GCC diagnostic pop
|
New file |
| | |
| | | /**
|
| | | *Macros for metaprogramming
|
| | | *ExtendedC
|
| | | *
|
| | | *Copyright (C) 2012 Justin Spahr-Summers
|
| | | *Released under the MIT license
|
| | | */
|
| | |
|
| | | #ifndef OBS_EXTC_METAMACROS_H
|
| | | #define OBS_EXTC_METAMACROS_H
|
| | |
|
| | | /**
|
| | | *Executes one or more expressions (which may have a void type, such as a call
|
| | | *to a function that returns no value) and always returns true.
|
| | | */
|
| | | #define obs_metamacro_exprify(...) \
|
| | | ((__VA_ARGS__), true)
|
| | |
|
| | | /**
|
| | | *Returns a string representation of VALUE after full macro expansion.
|
| | | */
|
| | | #define obs_metamacro_stringify(VALUE) \
|
| | | obs_metamacro_stringify_(VALUE)
|
| | |
|
| | | /**
|
| | | *Returns A and B concatenated after full macro expansion.
|
| | | */
|
| | | #define obs_metamacro_concat(A, B) \
|
| | | obs_metamacro_concat_(A, B)
|
| | |
|
| | | /**
|
| | | *Returns the Nth variadic argument (starting from zero). At least
|
| | | *N + 1 variadic arguments must be given. N must be between zero and twenty,
|
| | | *inclusive.
|
| | | */
|
| | | #define obs_metamacro_at(N, ...) \
|
| | | obs_metamacro_concat(obs_metamacro_at, N)(__VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Returns the number of arguments (up to twenty) provided to the macro. At
|
| | | *least one argument must be provided.
|
| | | *
|
| | | *Inspired by P99: http://p99.gforge.inria.fr
|
| | | */
|
| | | #define obs_metamacro_argcount(...) \
|
| | | obs_metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
|
| | |
|
| | | /**
|
| | | *Identical to #obs_metamacro_foreach_cxt, except that no CONTEXT argument is
|
| | | *given. Only the index and current argument will thus be passed to MACRO.
|
| | | */
|
| | | #define obs_metamacro_foreach(MACRO, SEP, ...) \
|
| | | obs_metamacro_foreach_cxt(obs_metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *For each consecutive variadic argument (up to twenty), MACRO is passed the
|
| | | *zero-based index of the current argument, CONTEXT, and then the argument
|
| | | *itself. The results of adjoining invocations of MACRO are then separated by
|
| | | *SEP.
|
| | | *
|
| | | *Inspired by P99: http://p99.gforge.inria.fr
|
| | | */
|
| | | #define obs_metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \
|
| | | obs_metamacro_concat(obs_metamacro_foreach_cxt, obs_metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Identical to #obs_metamacro_foreach_cxt. This can be used when the former would
|
| | | *fail due to recursive macro expansion.
|
| | | */
|
| | | #define obs_metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \
|
| | | obs_metamacro_concat(obs_metamacro_foreach_cxt_recursive, obs_metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *In consecutive order, appends each variadic argument (up to twenty) onto
|
| | | *BASE. The resulting concatenations are then separated by SEP.
|
| | | *
|
| | | *This is primarily useful to manipulate a list of macro invocations into instead
|
| | | *invoking a different, possibly related macro.
|
| | | */
|
| | | #define obs_metamacro_foreach_concat(BASE, SEP, ...) \
|
| | | obs_metamacro_foreach_cxt(obs_metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Iterates COUNT times, each time invoking MACRO with the current index
|
| | | *(starting at zero) and CONTEXT. The results of adjoining invocations of MACRO
|
| | | *are then separated by SEP.
|
| | | *
|
| | | *COUNT must be an integer between zero and twenty, inclusive.
|
| | | */
|
| | | #define obs_metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_concat(obs_metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT)
|
| | |
|
| | | /**
|
| | | *Returns the first argument given. At least one argument must be provided.
|
| | | *
|
| | | *This is useful when implementing a variadic macro, where you may have only
|
| | | *one variadic argument, but no way to retrieve it (for example, because \c ...
|
| | | *always needs to match at least one argument).
|
| | | *
|
| | | *@code
|
| | |
|
| | | #define varmacro(...) \
|
| | | obs_metamacro_head(__VA_ARGS__)
|
| | |
|
| | | *@endcode
|
| | | */
|
| | | #define obs_metamacro_head(...) \
|
| | | obs_metamacro_head_(__VA_ARGS__, 0)
|
| | |
|
| | | /**
|
| | | *Returns every argument except the first. At least two arguments must be
|
| | | *provided.
|
| | | */
|
| | | #define obs_metamacro_tail(...) \
|
| | | obs_metamacro_tail_(__VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Returns the first N (up to twenty) variadic arguments as a new argument list.
|
| | | *At least N variadic arguments must be provided.
|
| | | */
|
| | | #define obs_metamacro_take(N, ...) \
|
| | | obs_metamacro_concat(obs_metamacro_take, N)(__VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Removes the first N (up to twenty) variadic arguments from the given argument
|
| | | *list. At least N variadic arguments must be provided.
|
| | | */
|
| | | #define obs_metamacro_drop(N, ...) \
|
| | | obs_metamacro_concat(obs_metamacro_drop, N)(__VA_ARGS__)
|
| | |
|
| | | /**
|
| | | *Decrements VAL, which must be a number between zero and twenty, inclusive.
|
| | | *
|
| | | *This is primarily useful when dealing with indexes and counts in
|
| | | *metaprogramming.
|
| | | */
|
| | | #define obs_metamacro_dec(VAL) \
|
| | | obs_metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
|
| | |
|
| | | /**
|
| | | *Increments VAL, which must be a number between zero and twenty, inclusive.
|
| | | *
|
| | | *This is primarily useful when dealing with indexes and counts in
|
| | | *metaprogramming.
|
| | | */
|
| | | #define obs_metamacro_inc(VAL) \
|
| | | obs_metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21)
|
| | |
|
| | | /**
|
| | | *If A is equal to B, the next argument list is expanded; otherwise, the
|
| | | *argument list after that is expanded. A and B must be numbers between zero
|
| | | *and twenty, inclusive. Additionally, B must be greater than or equal to A.
|
| | | *
|
| | | *@code
|
| | |
|
| | | // expands to true
|
| | | obs_metamacro_if_eq(0, 0)(true)(false)
|
| | |
|
| | | // expands to false
|
| | | obs_metamacro_if_eq(0, 1)(true)(false)
|
| | |
|
| | | *@endcode
|
| | | *
|
| | | *This is primarily useful when dealing with indexes and counts in
|
| | | *metaprogramming.
|
| | | */
|
| | | #define obs_metamacro_if_eq(A, B) \
|
| | | obs_metamacro_concat(obs_metamacro_if_eq, A)(B)
|
| | |
|
| | | /**
|
| | | *Identical to #obs_metamacro_if_eq. This can be used when the former would fail
|
| | | *due to recursive macro expansion.
|
| | | */
|
| | | #define obs_metamacro_if_eq_recursive(A, B) \
|
| | | obs_metamacro_concat(obs_metamacro_if_eq_recursive, A)(B)
|
| | |
|
| | | /**
|
| | | *Returns 1 if N is an even number, or 0 otherwise. N must be between zero and
|
| | | *twenty, inclusive.
|
| | | *
|
| | | *For the purposes of this test, zero is considered even.
|
| | | */
|
| | | #define obs_metamacro_is_even(N) \
|
| | | obs_metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
|
| | |
|
| | | /**
|
| | | *Returns the logical NOT of B, which must be the number zero or one.
|
| | | */
|
| | | #define obs_metamacro_not(B) \
|
| | | obs_metamacro_at(B, 1, 0)
|
| | |
|
| | | // IMPLEMENTATION DETAILS FOLLOW!
|
| | | // Do not write code that depends on anything below this line.
|
| | | #define obs_metamacro_stringify_(VALUE) # VALUE
|
| | | #define obs_metamacro_concat_(A, B) A ## B
|
| | | #define obs_metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG)
|
| | | #define obs_metamacro_head_(FIRST, ...) FIRST
|
| | | #define obs_metamacro_tail_(FIRST, ...) __VA_ARGS__
|
| | | #define obs_metamacro_consume_(...)
|
| | | #define obs_metamacro_expand_(...) __VA_ARGS__
|
| | |
|
| | | // implemented from scratch so that obs_metamacro_concat() doesn't end up nesting
|
| | | #define obs_metamacro_foreach_concat_iter(INDEX, BASE, ARG) obs_metamacro_foreach_concat_iter_(BASE, ARG)
|
| | | #define obs_metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG
|
| | |
|
| | | // obs_metamacro_at expansions
|
| | | #define obs_metamacro_at0(...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at1(_0, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at2(_0, _1, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at3(_0, _1, _2, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at4(_0, _1, _2, _3, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at5(_0, _1, _2, _3, _4, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at6(_0, _1, _2, _3, _4, _5, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) obs_metamacro_head(__VA_ARGS__)
|
| | |
|
| | | // obs_metamacro_foreach_cxt expansions
|
| | | #define obs_metamacro_foreach_cxt0(MACRO, SEP, CONTEXT)
|
| | | #define obs_metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \
|
| | | obs_metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \
|
| | | SEP \
|
| | | MACRO(1, CONTEXT, _1)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
| | | obs_metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \
|
| | | SEP \
|
| | | MACRO(2, CONTEXT, _2)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
| | | obs_metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
| | | SEP \
|
| | | MACRO(3, CONTEXT, _3)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
| | | obs_metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
| | | SEP \
|
| | | MACRO(4, CONTEXT, _4)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
| | | obs_metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
| | | SEP \
|
| | | MACRO(5, CONTEXT, _5)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
| | | obs_metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
| | | SEP \
|
| | | MACRO(6, CONTEXT, _6)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
| | | obs_metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
| | | SEP \
|
| | | MACRO(7, CONTEXT, _7)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
| | | obs_metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
| | | SEP \
|
| | | MACRO(8, CONTEXT, _8)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
| | | obs_metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
| | | SEP \
|
| | | MACRO(9, CONTEXT, _9)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
| | | obs_metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
| | | SEP \
|
| | | MACRO(10, CONTEXT, _10)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
| | | obs_metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
| | | SEP \
|
| | | MACRO(11, CONTEXT, _11)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
| | | obs_metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
| | | SEP \
|
| | | MACRO(12, CONTEXT, _12)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
| | | obs_metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
| | | SEP \
|
| | | MACRO(13, CONTEXT, _13)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
| | | obs_metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
| | | SEP \
|
| | | MACRO(14, CONTEXT, _14)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
| | | obs_metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
| | | SEP \
|
| | | MACRO(15, CONTEXT, _15)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
| | | obs_metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
| | | SEP \
|
| | | MACRO(16, CONTEXT, _16)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
| | | obs_metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
| | | SEP \
|
| | | MACRO(17, CONTEXT, _17)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
| | | obs_metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
| | | SEP \
|
| | | MACRO(18, CONTEXT, _18)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \
|
| | | obs_metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
| | | SEP \
|
| | | MACRO(19, CONTEXT, _19)
|
| | |
|
| | | // obs_metamacro_foreach_cxt_recursive expansions
|
| | | #define obs_metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT)
|
| | | #define obs_metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \
|
| | | obs_metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \
|
| | | SEP \
|
| | | MACRO(1, CONTEXT, _1)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
| | | obs_metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \
|
| | | SEP \
|
| | | MACRO(2, CONTEXT, _2)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
| | | obs_metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \
|
| | | SEP \
|
| | | MACRO(3, CONTEXT, _3)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
| | | obs_metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \
|
| | | SEP \
|
| | | MACRO(4, CONTEXT, _4)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
| | | obs_metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \
|
| | | SEP \
|
| | | MACRO(5, CONTEXT, _5)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
| | | obs_metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \
|
| | | SEP \
|
| | | MACRO(6, CONTEXT, _6)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
| | | obs_metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \
|
| | | SEP \
|
| | | MACRO(7, CONTEXT, _7)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
| | | obs_metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \
|
| | | SEP \
|
| | | MACRO(8, CONTEXT, _8)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
| | | obs_metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \
|
| | | SEP \
|
| | | MACRO(9, CONTEXT, _9)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
| | | obs_metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \
|
| | | SEP \
|
| | | MACRO(10, CONTEXT, _10)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
| | | obs_metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \
|
| | | SEP \
|
| | | MACRO(11, CONTEXT, _11)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
| | | obs_metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \
|
| | | SEP \
|
| | | MACRO(12, CONTEXT, _12)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
| | | obs_metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \
|
| | | SEP \
|
| | | MACRO(13, CONTEXT, _13)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
| | | obs_metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \
|
| | | SEP \
|
| | | MACRO(14, CONTEXT, _14)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
| | | obs_metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \
|
| | | SEP \
|
| | | MACRO(15, CONTEXT, _15)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
| | | obs_metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \
|
| | | SEP \
|
| | | MACRO(16, CONTEXT, _16)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
| | | obs_metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
|
| | | SEP \
|
| | | MACRO(17, CONTEXT, _17)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
| | | obs_metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \
|
| | | SEP \
|
| | | MACRO(18, CONTEXT, _18)
|
| | |
|
| | | #define obs_metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \
|
| | | obs_metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \
|
| | | SEP \
|
| | | MACRO(19, CONTEXT, _19)
|
| | |
|
| | | // obs_metamacro_for_cxt expansions
|
| | | #define obs_metamacro_for_cxt0(MACRO, SEP, CONTEXT)
|
| | | #define obs_metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt2(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt1(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(1, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt3(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt2(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(2, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt4(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt3(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(3, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt5(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt4(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(4, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt6(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt5(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(5, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt7(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt6(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(6, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt8(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt7(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(7, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt9(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt8(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(8, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt10(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt9(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(9, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt11(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt10(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(10, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt12(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt11(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(11, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt13(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt12(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(12, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt14(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt13(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(13, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt15(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt14(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(14, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt16(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt15(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(15, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt17(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt16(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(16, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt18(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt17(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(17, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt19(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt18(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(18, CONTEXT)
|
| | |
|
| | | #define obs_metamacro_for_cxt20(MACRO, SEP, CONTEXT) \
|
| | | obs_metamacro_for_cxt19(MACRO, SEP, CONTEXT) \
|
| | | SEP \
|
| | | MACRO(19, CONTEXT)
|
| | |
|
| | | // obs_metamacro_if_eq expansions
|
| | | #define obs_metamacro_if_eq0(VALUE) \
|
| | | obs_metamacro_concat(obs_metamacro_if_eq0_, VALUE)
|
| | |
|
| | | #define obs_metamacro_if_eq0_0(...) __VA_ARGS__ obs_metamacro_consume_
|
| | | #define obs_metamacro_if_eq0_1(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_2(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_3(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_4(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_5(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_6(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_7(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_8(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_9(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_10(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_11(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_12(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_13(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_14(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_15(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_16(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_17(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_18(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_19(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq0_20(...) obs_metamacro_expand_
|
| | |
|
| | | #define obs_metamacro_if_eq1(VALUE) obs_metamacro_if_eq0(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq2(VALUE) obs_metamacro_if_eq1(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq3(VALUE) obs_metamacro_if_eq2(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq4(VALUE) obs_metamacro_if_eq3(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq5(VALUE) obs_metamacro_if_eq4(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq6(VALUE) obs_metamacro_if_eq5(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq7(VALUE) obs_metamacro_if_eq6(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq8(VALUE) obs_metamacro_if_eq7(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq9(VALUE) obs_metamacro_if_eq8(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq10(VALUE) obs_metamacro_if_eq9(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq11(VALUE) obs_metamacro_if_eq10(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq12(VALUE) obs_metamacro_if_eq11(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq13(VALUE) obs_metamacro_if_eq12(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq14(VALUE) obs_metamacro_if_eq13(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq15(VALUE) obs_metamacro_if_eq14(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq16(VALUE) obs_metamacro_if_eq15(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq17(VALUE) obs_metamacro_if_eq16(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq18(VALUE) obs_metamacro_if_eq17(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq19(VALUE) obs_metamacro_if_eq18(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq20(VALUE) obs_metamacro_if_eq19(obs_metamacro_dec(VALUE))
|
| | |
|
| | | // obs_metamacro_if_eq_recursive expansions
|
| | | #define obs_metamacro_if_eq_recursive0(VALUE) \
|
| | | obs_metamacro_concat(obs_metamacro_if_eq_recursive0_, VALUE)
|
| | |
|
| | | #define obs_metamacro_if_eq_recursive0_0(...) __VA_ARGS__ obs_metamacro_consume_
|
| | | #define obs_metamacro_if_eq_recursive0_1(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_2(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_3(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_4(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_5(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_6(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_7(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_8(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_9(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_10(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_11(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_12(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_13(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_14(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_15(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_16(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_17(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_18(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_19(...) obs_metamacro_expand_
|
| | | #define obs_metamacro_if_eq_recursive0_20(...) obs_metamacro_expand_
|
| | |
|
| | | #define obs_metamacro_if_eq_recursive1(VALUE) obs_metamacro_if_eq_recursive0(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive2(VALUE) obs_metamacro_if_eq_recursive1(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive3(VALUE) obs_metamacro_if_eq_recursive2(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive4(VALUE) obs_metamacro_if_eq_recursive3(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive5(VALUE) obs_metamacro_if_eq_recursive4(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive6(VALUE) obs_metamacro_if_eq_recursive5(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive7(VALUE) obs_metamacro_if_eq_recursive6(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive8(VALUE) obs_metamacro_if_eq_recursive7(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive9(VALUE) obs_metamacro_if_eq_recursive8(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive10(VALUE) obs_metamacro_if_eq_recursive9(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive11(VALUE) obs_metamacro_if_eq_recursive10(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive12(VALUE) obs_metamacro_if_eq_recursive11(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive13(VALUE) obs_metamacro_if_eq_recursive12(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive14(VALUE) obs_metamacro_if_eq_recursive13(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive15(VALUE) obs_metamacro_if_eq_recursive14(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive16(VALUE) obs_metamacro_if_eq_recursive15(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive17(VALUE) obs_metamacro_if_eq_recursive16(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive18(VALUE) obs_metamacro_if_eq_recursive17(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive19(VALUE) obs_metamacro_if_eq_recursive18(obs_metamacro_dec(VALUE))
|
| | | #define obs_metamacro_if_eq_recursive20(VALUE) obs_metamacro_if_eq_recursive19(obs_metamacro_dec(VALUE))
|
| | |
|
| | | // obs_metamacro_take expansions
|
| | | #define obs_metamacro_take0(...)
|
| | | #define obs_metamacro_take1(...) obs_metamacro_head(__VA_ARGS__)
|
| | | #define obs_metamacro_take2(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take1(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take3(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take2(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take4(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take3(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take5(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take4(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take6(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take5(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take7(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take6(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take8(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take7(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take9(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take8(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take10(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take9(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take11(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take10(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take12(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take11(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take13(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take12(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take14(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take13(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take15(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take14(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take16(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take15(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take17(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take16(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take18(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take17(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take19(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take18(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_take20(...) obs_metamacro_head(__VA_ARGS__), obs_metamacro_take19(obs_metamacro_tail(__VA_ARGS__))
|
| | |
|
| | | // obs_metamacro_drop expansions
|
| | | #define obs_metamacro_drop0(...) __VA_ARGS__
|
| | | #define obs_metamacro_drop1(...) obs_metamacro_tail(__VA_ARGS__)
|
| | | #define obs_metamacro_drop2(...) obs_metamacro_drop1(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop3(...) obs_metamacro_drop2(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop4(...) obs_metamacro_drop3(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop5(...) obs_metamacro_drop4(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop6(...) obs_metamacro_drop5(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop7(...) obs_metamacro_drop6(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop8(...) obs_metamacro_drop7(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop9(...) obs_metamacro_drop8(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop10(...) obs_metamacro_drop9(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop11(...) obs_metamacro_drop10(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop12(...) obs_metamacro_drop11(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop13(...) obs_metamacro_drop12(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop14(...) obs_metamacro_drop13(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop15(...) obs_metamacro_drop14(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop16(...) obs_metamacro_drop15(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop17(...) obs_metamacro_drop16(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop18(...) obs_metamacro_drop17(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop19(...) obs_metamacro_drop18(obs_metamacro_tail(__VA_ARGS__))
|
| | | #define obs_metamacro_drop20(...) obs_metamacro_drop19(obs_metamacro_tail(__VA_ARGS__))
|
| | |
|
| | | #endif
|
New file |
| | |
| | | framework module OBS { |
| | | umbrella header "OBS.h" |
| | | |
| | | export * |
| | | module * { export * } |
| | | } |
| | |
| | | extension UserProfileVC:TZImagePickerControllerDelegate{ |
| | | public func imagePickerController(_ picker: TZImagePickerController!, didFinishPickingPhotos photos: [UIImage]!, sourceAssets assets: [Any]!, isSelectOriginalPhoto: Bool) { |
| | | picker.selectedAssets = NSMutableArray(array: assets) |
| | | |
| | | if let photo = photos.first{ |
| | | photo.jq_scaled(to: CGSize(width: 250, height: 250)).uploadImg().subscribe(onNext: {imageUrl in |
| | | Services.updateUserInfo(avatar:imageUrl).subscribe(onNext: {data in |
| | | NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil) |
| | | }).disposed(by: self.disposeBag) |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | |
| | | public func imagePickerController(_ picker: TZImagePickerController!, didFinishPickingAndEditingVideo coverImage: UIImage!, outputPath: String!, error errorMsg: String!) { |
| | |
| | | |
| | | unowned let weakSelf = self |
| | | corpperVC.imageCropperHandler { (vc, image) in |
| | | |
| | | image.uploadImg().subscribe(onNext: {imageUrl in |
| | | Services.updateUserInfo(avatar:imageUrl).subscribe(onNext: {data in |
| | | NotificationCenter.default.post(name: UpdateUserProfile_Noti, object: nil) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } cancelClouse: { |
| | | corpperVC.dismiss(animated: true) { |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | picker.dismiss(animated: true) { |
| | | |
| | | } |
New file |
| | |
| | | import UIKit |
| | | import RxSwift |
| | | import RxCocoa |
| | | import SVProgressHUD |
| | | import OBS |
| | | import JQTools |
| | | import RxRelay |
| | | |
| | | let endPoint = "obs.cn-south-1.myhuaweicloud.com"; |
| | | let accessKeyId = "HNZKSJL5LKM2NZVJPE8O"; |
| | | let accessKeySecret = "VjKImAoCB8Q2lEcwGO9xIemirpOVZuij9DVRSXcr"; |
| | | let bucketName = "xqgwzh"; |
| | | let oss_domain = "https://xqgwzh.obs.cn-south-1.myhuaweicloud.com"; |
| | | let OBS_URL = "https://\(endPoint)" |
| | | class OBSUploader: NSObject { |
| | | static let shared = OBSUploader() |
| | | |
| | | private let disposeBag = DisposeBag() |
| | | var configuration: OBSServiceConfiguration { |
| | | let credentailProvider = OBSStaticCredentialProvider(accessKey: accessKeyId, secretKey: accessKeySecret) |
| | | return OBSServiceConfiguration(url: URL(string: OBS_URL),credentialProvider: credentailProvider) |
| | | } |
| | | |
| | | lazy var obsClient: OBSClient = OBSClient.init(configuration: configuration) |
| | | func uploadImage(keys: [String], image: [UIImage]) -> Observable<[String]> { |
| | | if keys.count == 0 { |
| | | return Observable.just([]) |
| | | } |
| | | var ob: [Observable<String>] = [] |
| | | let count = keys.count |
| | | for i in 0..<count { |
| | | ob.append(createTask(key: keys[i], image: image[i])) |
| | | } |
| | | return Observable.zip(ob) |
| | | } |
| | | |
| | | func uploadDatas(keys: [String], image: [Data],type:[String],showHUD:Bool = true) -> Observable<[String]> { |
| | | if keys.count == 0 { |
| | | return Observable.just([]) |
| | | } |
| | | var ob: [Observable<String>] = [] |
| | | let count = keys.count |
| | | for i in 0..<count { |
| | | var t = type[i] |
| | | if t.int == 1 { |
| | | t = ".png" |
| | | }else{ |
| | | t = ".mp4" |
| | | } |
| | | ob.append(uploadFilePath(key: keys[i], filePath: image[i], type: t)) |
| | | } |
| | | return Observable.zip(ob) |
| | | } |
| | | |
| | | func uploadImage(key: String, image: UIImage,showHUD:Bool = true,resize:Bool = true,needCheck:Bool = true) -> Observable<String> { |
| | | if key.isEmpty { |
| | | return Observable.just("") |
| | | } else { |
| | | if showHUD{ |
| | | DispatchQueue.main.async { |
| | | SVProgressHUD.show(withStatus: "上传中") |
| | | } |
| | | } |
| | | var uploadImage:Data? |
| | | if resize{ |
| | | uploadImage = image.pngData() |
| | | }else{ |
| | | uploadImage = image.pngData() |
| | | } |
| | | let client = obsClient |
| | | return Observable<String>.create{ ob in |
| | | let put = OBSPutObjectWithDataRequest.init(bucketName: bucketName, objectKey: "\(key).png", uploadData: uploadImage) |
| | | let task = client.putObject(put, completionHandler: { (response, error) in |
| | | }) |
| | | task?.continueWith(block: { (r) -> Any? in |
| | | DispatchQueue.main.async { |
| | | SVProgressHUD.dismiss() |
| | | } |
| | | if r.error == nil { |
| | | let url = "\(oss_domain)/\(key).png" |
| | | ob.onNext(url) |
| | | } else { |
| | | ob.onError(OBSUploaderError.Failed) |
| | | DispatchQueue.main.async { |
| | | SVProgressHUD.dismiss() |
| | | alertError(msg: r.error?.localizedDescription ?? "") |
| | | } |
| | | } |
| | | return nil |
| | | }) |
| | | return Disposables.create{ |
| | | } |
| | | }.observe(on: MainScheduler.instance) |
| | | } |
| | | } |
| | | |
| | | func uploadFilePath(key: String, filePath: Data,type:String) -> Observable<String> { |
| | | if key.isEmpty { |
| | | return Observable.just("") |
| | | } else { |
| | | DispatchQueue.main.async { |
| | | SVProgressHUD.show() |
| | | } |
| | | let client = obsClient |
| | | return Observable<String>.create{ ob in |
| | | let put = OBSPutObjectWithDataRequest.init(bucketName: bucketName, objectKey: "\(key)\(type)", uploadData:filePath) |
| | | let task = client.putObject(put, completionHandler: { (response, error) in |
| | | }) |
| | | task?.continueWith(block: { (r) -> Any? in |
| | | DispatchQueue.main.async { |
| | | // SVProgressHUD.dismiss() |
| | | } |
| | | if r.error == nil { |
| | | let url = "\(oss_domain)/\(key)\(type)" |
| | | ob.onNext(url) |
| | | } else { |
| | | ob.onError(OBSUploaderError.Failed) |
| | | DispatchQueue.main.async { |
| | | alertError(msg: r.error?.localizedDescription ?? "") |
| | | } |
| | | } |
| | | return nil |
| | | }) |
| | | return Disposables.create{ |
| | | } |
| | | }.observe(on: MainScheduler.instance) |
| | | } |
| | | } |
| | | |
| | | func createTask(key: String, image: UIImage) -> Observable<String> { |
| | | let client = obsClient |
| | | return Observable<String>.create{ ob in |
| | | let imageData = image.pngData() |
| | | let put = OBSPutObjectWithDataRequest.init(bucketName: bucketName, objectKey: "\(key).png", uploadData: imageData) |
| | | let task = client.putObject(put, completionHandler: { (response, error) in |
| | | }) |
| | | task?.continueWith(block: { (r) -> Any? in |
| | | if r.error == nil { |
| | | let url = "\(oss_domain)/\(key).png" |
| | | ob.onNext(url) |
| | | } else { |
| | | ob.onError(OBSUploaderError.Failed) |
| | | } |
| | | return nil |
| | | }) |
| | | return Disposables.create{ |
| | | } |
| | | }.observe(on: MainScheduler.instance) |
| | | } |
| | | } |
| | | |
| | | |
| | | public extension Sequence where Iterator.Element == UIImage{ |
| | | func uploadImgToService(scaleSize:CGSize? = nil,needCompress:Bool? = nil)->Observable<[String]>{ |
| | | var keys = [String]() |
| | | var imgs = [UIImage]() |
| | | for (_,item) in enumerated() { |
| | | keys.append(String.jq_randomStr(len: 10)) |
| | | imgs.append(item) |
| | | } |
| | | return OBSUploader.shared.uploadImage(keys: keys, image: imgs) |
| | | } |
| | | } |
| | | |
| | | public extension UIImage{ |
| | | func uploadImg()->Observable<String>{ |
| | | return OBSUploader.shared.uploadImage(key: String.jq_randomStr(len: 10), image: self, showHUD: true, resize: true, needCheck: false) |
| | | } |
| | | } |
| | | |
| | | enum OBSUploaderError: Error { |
| | | case Failed |
| | | } |
| | |
| | | |
| | | private var treeInfoModel:TreeInfoModel? |
| | | |
| | | private lazy var voicePlayer:AVPlayer = { |
| | | let p = AVPlayer() |
| | | return p |
| | | }() |
| | | |
| | | override func viewDidDisappear(_ animated: Bool) { |
| | | super.viewDidDisappear(animated) |
| | | player.pause() |
| | |
| | | alert(msg: "已经没有能量值了,快去做任务吧");return |
| | | } |
| | | |
| | | Services.watering().subscribe(onNext: {data in |
| | | Services.watering().subscribe(onNext: {[weak self] data in |
| | | guard let weakSelf = self else { return } |
| | | if let m = data.data{ |
| | | sender.isUserInteractionEnabled = true |
| | | if m.isNext{ |
| | | let type = self.treeInfoModel?.treeLevelType ?? .level_1 |
| | | self.treeInfoModel!.treeLevelType = TreeLevel(rawValue: type.rawValue + 1) ?? .level_1 |
| | | let type = weakSelf.treeInfoModel?.treeLevelType ?? .level_1 |
| | | weakSelf.treeInfoModel!.treeLevelType = TreeLevel(rawValue: type.rawValue + 1) ?? .level_1 |
| | | |
| | | let h = (JQ_ScreenW - 90) * 0.7729 |
| | | TreeTeskFirstRuleView.show(title: "升级", content:"恭喜!你的树苗已升级为\(self.treeInfoModel!.treeLevelType.title)阶段!",textAlignment: .center,height: h,textTopOffset: 57) |
| | | TreeTeskFirstRuleView.show(title: "升级", content:"恭喜!你的树苗已升级为\(weakSelf.treeInfoModel!.treeLevelType.title)阶段!",textAlignment: .center,height: h,textTopOffset: 57) |
| | | |
| | | self.updateAni() |
| | | if let soundURL = URL(string:weakSelf.treeInfoModel?.treeLevelType.sound){ |
| | | weakSelf.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | weakSelf.voicePlayer.play() |
| | | } |
| | | weakSelf.updateAni() |
| | | } |
| | | self.treeInfoModel?.currentEnergyValue = 0 |
| | | self.treeInfoModel?.growthValue = m.growthValue |
| | | self.treeInfoModel?.nextLevel = m.nextLevel |
| | | self.updateTreeInfo() |
| | | weakSelf.treeInfoModel?.currentEnergyValue = 0 |
| | | weakSelf.treeInfoModel?.growthValue = m.growthValue |
| | | weakSelf.treeInfoModel?.nextLevel = m.nextLevel |
| | | weakSelf.updateTreeInfo() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |