protected override void ProcessRecord() { base.ProcessRecord(); UpdateWaasPolicyRequest request; try { request = new UpdateWaasPolicyRequest { WaasPolicyId = WaasPolicyId, UpdateWaasPolicyDetails = UpdateWaasPolicyDetails, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken, IfMatch = IfMatch }; response = client.UpdateWaasPolicy(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Updates the details of a WAAS policy, including origins and tags. /// Only the fields specified in the request body will be updated; all other properties will remain unchanged. /// To update platform provided resources such as GoodBots, ProtectionRules, and ThreatFeeds, first retrieve the list of available resources with the related list operation such as /// GetThreatFeeds or GetProtectionRules. /// The returned list will contain objects with key properties that can be used to update the resource during the UpdateWaasPolicy request. /// </summary> /// <param name="request"></param> /// <returns></returns> public UpdateWaasPolicyResponse UpdateWaasPolicy(UpdateWaasPolicyRequest request) { var uri = new Uri($"{GetEndPoint(WaasServices.WaasPolicies, this.Region)}/{request.WaasPolicyId}"); var httpRequestHeaderParam = new HttpRequestHeaderParam() { OpcRetryToken = request.OpcRetryToken, OpcRequestId = request.OpcRequestId, IfMatch = request.IfMatch }; using (var webResponse = this.RestClient.Put(uri, request.UpdateWaasPolicyDetails, httpRequestHeaderParam)) using (var stream = webResponse.GetResponseStream()) using (var reader = new StreamReader(stream)) { var response = reader.ReadToEnd(); return(new UpdateWaasPolicyResponse() { OpcRequestId = webResponse.Headers.Get("opc-request-id"), OpcWorkRequestId = webResponse.Headers.Get("opc-work-request-id") }); } }