/// <summary> /// 为指定云硬盘批量添加标签 /// </summary> public BatchCreateVolumeTagsResponse BatchCreateVolumeTags(BatchCreateVolumeTagsRequest batchCreateVolumeTagsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("volume_id", batchCreateVolumeTagsRequest.VolumeId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v2/{project_id}/cloudvolumes/{volume_id}/tags/action", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", batchCreateVolumeTagsRequest); HttpResponseMessage response = DoHttpRequestSync("POST", request); return(JsonUtils.DeSerializeNull <BatchCreateVolumeTagsResponse>(response)); }
private static void BatchCreateVolumeTags(EvsClient client) { var req = new BatchCreateVolumeTagsRequest() { VolumeId = "04495fb2-f1e8-40aa-8725-c197a246376d", Body = new BatchCreateVolumeTagsRequestBody() { Action = BatchCreateVolumeTagsRequestBody.ActionEnum.CREATE, Tags = new List <HuaweiCloud.SDK.Evs.V2.Model.Tag> { new HuaweiCloud.SDK.Evs.V2.Model.Tag() { Key = "123", Value = "456" } } } }; try { var resp = client.BatchCreateVolumeTags(req); Console.WriteLine(resp.HttpStatusCode); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }