|
| 1 | +// |
| 2 | +// GetObjectTagging.m |
| 3 | +// GetObjectTagging |
| 4 | +// |
| 5 | +// Created by tencent |
| 6 | +// Copyright (c) 2015年 tencent. All rights reserved. |
| 7 | +// |
| 8 | +// ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ |
| 9 | +// ██████╗ |
| 10 | +// ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗ |
| 11 | +// ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝ |
| 12 | +// ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗ |
| 13 | +// ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ |
| 14 | +// ██║██████╔╝ |
| 15 | +// ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝ |
| 16 | +// |
| 17 | +// |
| 18 | +// _ __ _ _ |
| 19 | +// (_) / _| | | | | |
| 20 | +// ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ |
| 21 | +// __ ___ |
| 22 | +// / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ |
| 23 | +// '__/ __| |
| 24 | +// \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ |
| 25 | +// | \__ |
| 26 | +// |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ |
| 27 | +// \___|_| |___/ |
| 28 | +// ______ ______ ______ ______ ______ ______ ______ ______ | | |
| 29 | +// |______|______|______|______|______|______|______|______| |_| |
| 30 | +// |
| 31 | + |
| 32 | +#import "QCloudDeleteObjectTaggingRequest.h" |
| 33 | +#import <QCloudCore/QCloudSignatureFields.h> |
| 34 | +#import <QCloudCore/QCloudCore.h> |
| 35 | +#import <QCloudCore/QCloudServiceConfiguration_Private.h> |
| 36 | +#import "QCloudTagging.h" |
| 37 | + |
| 38 | +NS_ASSUME_NONNULL_BEGIN |
| 39 | +@implementation QCloudDeleteObjectTaggingRequest |
| 40 | +- (void)dealloc { |
| 41 | +} |
| 42 | +- (instancetype)init { |
| 43 | + self = [super init]; |
| 44 | + if (!self) { |
| 45 | + return nil; |
| 46 | + } |
| 47 | + return self; |
| 48 | +} |
| 49 | +- (void)configureReuqestSerializer:(QCloudRequestSerializer *)requestSerializer responseSerializer:(QCloudResponseSerializer *)responseSerializer { |
| 50 | + NSArray *customRequestSerilizers = @[ |
| 51 | + QCloudURLFuseURIMethodASURLParamters, |
| 52 | + ]; |
| 53 | + |
| 54 | + NSArray *responseSerializers = @[ |
| 55 | + QCloudAcceptRespnseCodeBlock([NSSet setWithObjects:@(200), @(201), @(202), @(203), @(204), @(205), @(206), @(207), @(208), @(226), nil], nil), |
| 56 | + QCloudResponseXMLSerializerBlock, |
| 57 | + ]; |
| 58 | + [requestSerializer setSerializerBlocks:customRequestSerilizers]; |
| 59 | + [responseSerializer setSerializerBlocks:responseSerializers]; |
| 60 | + |
| 61 | + requestSerializer.HTTPMethod = @"delete"; |
| 62 | +} |
| 63 | + |
| 64 | +- (BOOL)buildRequestData:(NSError *__autoreleasing *)error { |
| 65 | + if (![super buildRequestData:error]) { |
| 66 | + return NO; |
| 67 | + } |
| 68 | + if (!self.object || ([self.object isKindOfClass:NSString.class] && ((NSString *)self.object).length == 0)) { |
| 69 | + if (error != NULL) { |
| 70 | + *error = [NSError |
| 71 | + qcloud_errorWithCode:QCloudNetworkErrorCodeParamterInvalid |
| 72 | + message:[NSString stringWithFormat: |
| 73 | + @"InvalidArgument:paramter[object] is invalid (nil), it must have some value. please check it"]]; |
| 74 | + return NO; |
| 75 | + } |
| 76 | + } |
| 77 | + |
| 78 | + if (!self.bucket || ([self.bucket isKindOfClass:NSString.class] && ((NSString *)self.bucket).length == 0)) { |
| 79 | + if (error != NULL) { |
| 80 | + *error = [NSError |
| 81 | + qcloud_errorWithCode:QCloudNetworkErrorCodeParamterInvalid |
| 82 | + message:[NSString stringWithFormat: |
| 83 | + @"InvalidArgument:paramter[bucket] is invalid (nil), it must have some value. please check it"]]; |
| 84 | + return NO; |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + |
| 89 | + NSURL *__serverURL = [self.runOnService.configuration.endpoint serverURLWithBucket:self.bucket |
| 90 | + appID:self.runOnService.configuration.appID |
| 91 | + regionName:self.regionName]; |
| 92 | + self.requestData.serverURL = __serverURL.absoluteString; |
| 93 | + [self.requestData setValue:__serverURL.host forHTTPHeaderField:@"Host"]; |
| 94 | + self.requestData.URIMethod = @"tagging"; |
| 95 | + [self.requestData setQueryStringParamter:self.versionId withKey:@"VersionId"]; |
| 96 | + NSMutableArray *__pathComponents = [NSMutableArray arrayWithArray:self.requestData.URIComponents]; |
| 97 | + if (self.object) |
| 98 | + [__pathComponents addObject:self.object]; |
| 99 | + self.requestData.URIComponents = __pathComponents; |
| 100 | + return YES; |
| 101 | +} |
| 102 | +- (void)setFinishBlock:(void (^_Nullable)(id _Nullable result, NSError *_Nullable error))QCloudRequestFinishBlock { |
| 103 | + [super setFinishBlock:QCloudRequestFinishBlock]; |
| 104 | +} |
| 105 | + |
| 106 | +- (QCloudSignatureFields *)signatureFields { |
| 107 | + QCloudSignatureFields *fileds = [QCloudSignatureFields new]; |
| 108 | + |
| 109 | + return fileds; |
| 110 | +} |
| 111 | + |
| 112 | +@end |
| 113 | +NS_ASSUME_NONNULL_END |
0 commit comments