protected override void ProcessRecord() { ResponseType response = null; base.ProcessRecord(); try { var tagKey = new EditTagKeyType { id = Id, name = Name, nameSpecified = !string.IsNullOrEmpty(Name), description = Description, descriptionSpecified = Description != dummyText, displayOnReport = DisplayOnReport ?? false, displayOnReportSpecified = DisplayOnReport.HasValue, valueRequired = ValueRequired ?? false, valueRequiredSpecified = ValueRequired.HasValue }; response = Connection.ApiClient.Tagging.EditTagKey(tagKey).Result; } catch (AggregateException ae) { ae.Handle( e => { if (e is ComputeApiException) { WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection)); } else { // if (e is HttpRequestException) ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection)); } return(true); }); } WriteObject(response); }
/// <summary>The edit tag key.</summary> /// <param name="editTagKey">The edit tag key.</param> /// <returns>The <see cref="Task"/>.</returns> public async Task <ResponseType> EditTagKey(EditTagKeyType editTagKey) { return(await _apiClient.PostAsync <EditTagKeyType, ResponseType>(ApiUris.EditTagKey(_apiClient.OrganizationId), editTagKey)); }