-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
garenwang
committed
Feb 6, 2023
1 parent
4ef340b
commit 774ec1f
Showing
23 changed files
with
678 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
QCloudCOSXML/Classes/Manager/model/QCloudBucketPolicyResult.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// QCloudBucketPolicyResult.h | ||
// QCloudCOSXML | ||
// | ||
// Created by garenwang on 2023/2/4. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
@class QCloudBucketPolicyResultItem; | ||
@class QCloudBucketPolicyResultItemPrincipal; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface QCloudBucketPolicyResult : NSObject | ||
|
||
/// 权限策略生命列表 | ||
@property (strong, nonatomic) NSArray<QCloudBucketPolicyResultItem *> * Statement; | ||
|
||
/// 版本号,固定2.0 String 是 | ||
@property (strong, nonatomic) NSString * version; | ||
@end | ||
|
||
@interface QCloudBucketPolicyResultItem : NSObject | ||
|
||
/// 身份信息 ObjectArray 是 | ||
@property (strong, nonatomic) QCloudBucketPolicyResultItemPrincipal * Principal; | ||
|
||
/// 效力,枚举值:allow、deny String 是 | ||
@property (strong, nonatomic) NSString * Effect; | ||
|
||
/// 策略生效的相关 Action 列表,支持通配符* StringArray 是 | ||
@property (strong, nonatomic) NSArray * Action; | ||
|
||
/// 相关的资源标识字符串列表 | ||
@property (strong, nonatomic) NSArray * Resource; | ||
@end | ||
|
||
@interface QCloudBucketPolicyResultItemPrincipal : NSObject | ||
|
||
/// 身份信息标识字符串 | ||
/// 格式:qcs::cam::uin/100000000001:uin/100000000011 | ||
/// 其中100000000001 是主账号,100000000011是子账号 String 是 | ||
@property (strong, nonatomic) NSArray * qcs; | ||
@end | ||
NS_ASSUME_NONNULL_END |
28 changes: 28 additions & 0 deletions
28
QCloudCOSXML/Classes/Manager/model/QCloudBucketPolicyResult.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// QCloudBucketPolicyResult.m | ||
// QCloudCOSXML | ||
// | ||
// Created by garenwang on 2023/2/4. | ||
// | ||
|
||
#import "QCloudBucketPolicyResult.h" | ||
|
||
@implementation QCloudBucketPolicyResult | ||
+ (NSDictionary *)modelContainerPropertyGenericClass { | ||
return @{ | ||
@"Statement" : [QCloudBucketPolicyResultItem class], | ||
}; | ||
} | ||
@end | ||
|
||
@implementation QCloudBucketPolicyResultItem | ||
+ (NSDictionary *)modelContainerPropertyGenericClass { | ||
return @{ | ||
@"Principal" : [QCloudBucketPolicyResultItemPrincipal class], | ||
}; | ||
} | ||
@end | ||
|
||
@implementation QCloudBucketPolicyResultItemPrincipal | ||
|
||
@end |
64 changes: 64 additions & 0 deletions
64
QCloudCOSXML/Classes/Manager/request/QCloudDeleteBucketPolicyRequest.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// QCloudDeleteBucketPolicyRequest.h | ||
// QCloudDeleteBucketPolicyRequest | ||
// | ||
// Created by tencent | ||
// Copyright (c) 2015年 tencent. All rights reserved. | ||
// | ||
// ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ | ||
// ██████╗ | ||
// ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗ | ||
// ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝ | ||
// ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗ | ||
// ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ | ||
// ██║██████╔╝ | ||
// ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ | ||
// | ||
// | ||
// _ __ _ _ | ||
// (_) / _| | | | | | ||
// ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ | ||
// __ ___ | ||
// / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ | ||
// '__/ __| | ||
// \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | ||
// | \__ | ||
// |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ | ||
// \___|_| |___/ | ||
// ______ ______ ______ ______ ______ ______ ______ ______ | | | ||
// |______|______|______|______|______|______|______|______| |_| | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <QCloudCore/QCloudCore.h> | ||
NS_ASSUME_NONNULL_BEGIN | ||
/** | ||
### 功能说明 | ||
DELETE Bucket policy 请求可以向存储桶删除权限策略。 | ||
请查看 https://cloud.tencent.com/document/product/436/8285 | ||
### 示例 | ||
@code | ||
QCloudDeleteBucketPolicyRequest * request = [QCloudDeleteBucketPolicyRequest new]; | ||
request.bucket = @"0-1253960454"; | ||
request.regionName = @"ap-chengdu"; | ||
[request setFinishBlock:^(id _Nullable outputObject, NSError * _Nullable error) { | ||
[exp fulfill]; | ||
}]; | ||
[[QCloudCOSXMLService defaultCOSXML] DeleteBucketPolicy:request]; | ||
*/ | ||
@interface QCloudDeleteBucketPolicyRequest : QCloudBizHTTPRequest | ||
/** | ||
存储桶名 | ||
*/ | ||
@property (strong, nonatomic) NSString *bucket; | ||
|
||
|
||
@end | ||
NS_ASSUME_NONNULL_END |
94 changes: 94 additions & 0 deletions
94
QCloudCOSXML/Classes/Manager/request/QCloudDeleteBucketPolicyRequest.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// | ||
// QCloudDeleteBucketPolicyRequest.m | ||
// QCloudDeleteBucketPolicyRequest | ||
// | ||
// Created by tencent | ||
// Copyright (c) 2015年 tencent. All rights reserved. | ||
// | ||
// ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ | ||
// ██████╗ | ||
// ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗ | ||
// ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝ | ||
// ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗ | ||
// ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ | ||
// ██║██████╔╝ | ||
// ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ | ||
// | ||
// | ||
// _ __ _ _ | ||
// (_) / _| | | | | | ||
// ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ | ||
// __ ___ | ||
// / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ | ||
// '__/ __| | ||
// \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | ||
// | \__ | ||
// |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ | ||
// \___|_| |___/ | ||
// ______ ______ ______ ______ ______ ______ ______ ______ | | | ||
// |______|______|______|______|______|______|______|______| |_| | ||
// | ||
|
||
#import "QCloudDeleteBucketPolicyRequest.h" | ||
#import <QCloudCore/QCloudSignatureFields.h> | ||
#import <QCloudCore/QCloudCore.h> | ||
#import <QCloudCore/QCloudConfiguration_Private.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
@implementation QCloudDeleteBucketPolicyRequest | ||
- (void)dealloc { | ||
} | ||
- (instancetype)init { | ||
self = [super init]; | ||
if (!self) { | ||
return nil; | ||
} | ||
return self; | ||
} | ||
- (void)configureReuqestSerializer:(QCloudRequestSerializer *)requestSerializer responseSerializer:(QCloudResponseSerializer *)responseSerializer { | ||
NSArray *customRequestSerilizers = @[ | ||
QCloudURLFuseURIMethodASURLParamters, | ||
QCloudURLFuseContentMD5Base64StyleHeaders, | ||
]; | ||
|
||
NSArray *responseSerializers = @[ | ||
QCloudAcceptRespnseCodeBlock([NSSet setWithObjects:@(200), @(201), @(202), @(203), @(204), @(205), @(206), @(207), @(208), @(226), nil], nil), | ||
QCloudResponseAppendHeadersSerializerBlock | ||
|
||
]; | ||
[requestSerializer setSerializerBlocks:customRequestSerilizers]; | ||
[responseSerializer setSerializerBlocks:responseSerializers]; | ||
|
||
requestSerializer.HTTPMethod = @"delete"; | ||
} | ||
|
||
- (BOOL)buildRequestData:(NSError *__autoreleasing *)error { | ||
if (![super buildRequestData:error]) { | ||
return NO; | ||
} | ||
if (!self.bucket || ([self.bucket isKindOfClass:NSString.class] && ((NSString *)self.bucket).length == 0)) { | ||
if (error != NULL) { | ||
*error = [NSError | ||
qcloud_errorWithCode:QCloudNetworkErrorCodeParamterInvalid | ||
message:[NSString stringWithFormat: | ||
@"InvalidArgument:paramter[bucket] is invalid (nil), it must have some value. please check it"]]; | ||
return NO; | ||
} | ||
} | ||
NSURL *__serverURL = [self.runOnService.configuration.endpoint serverURLWithBucket:self.bucket | ||
appID:self.runOnService.configuration.appID | ||
regionName:self.regionName]; | ||
self.requestData.serverURL = __serverURL.absoluteString; | ||
[self.requestData setValue:__serverURL.host forHTTPHeaderField:@"Host"]; | ||
self.requestData.URIMethod = @"policy"; | ||
return YES; | ||
} | ||
|
||
- (QCloudSignatureFields *)signatureFields { | ||
QCloudSignatureFields *fileds = [QCloudSignatureFields new]; | ||
|
||
return fileds; | ||
} | ||
|
||
@end | ||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.